• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..17-Aug-2021-

benchmarks/H17-Aug-2021-397305

connection/H17-Aug-2021-1,7661,259

datatransfer/apiv1/H17-Aug-2021-2,9372,213

reservation/H17-Aug-2021-3,7402,638

storage/H17-Aug-2021-8,0465,830

CHANGES.mdH A D17-Aug-202114.8 KiB235144

README.mdH A D17-Aug-20211.2 KiB4843

bigquery.goH A D17-Aug-20217.4 KiB240150

bigquery.replayH A D17-Aug-2021928.5 KiB28,37628,376

bigquery_test.goH A D17-Aug-20212.6 KiB128109

copy.goH A D17-Aug-20214.1 KiB12774

copy_test.goH A D17-Aug-20214.4 KiB186166

dataset.goH A D17-Aug-202122.1 KiB740560

dataset_test.goH A D17-Aug-202114.1 KiB479431

doc.goH A D17-Aug-20219.9 KiB3171

error.goH A D17-Aug-20212.7 KiB10770

error_test.goH A D17-Aug-20213 KiB11591

examples_test.goH A D17-Aug-202120.2 KiB830609

external.goH A D17-Aug-202117.5 KiB526307

external_test.goH A D17-Aug-20214.2 KiB166143

extract.goH A D17-Aug-20214.1 KiB14693

extract_test.goH A D17-Aug-20214.9 KiB203175

file.goH A D17-Aug-20215.1 KiB15386

file_test.goH A D17-Aug-20214.2 KiB174153

gcs.goH A D17-Aug-20213 KiB8234

go.modH A D17-Aug-2021531 1916

go.sumH A D17-Aug-202152.5 KiB537536

go_mod_tidy_hack.goH A D17-Aug-2021919 232

iam.goH A D17-Aug-20214.1 KiB143105

iam_test.goH A D17-Aug-20211.6 KiB6646

inserter.goH A D17-Aug-20217.5 KiB249159

inserter_test.goH A D17-Aug-20216.4 KiB236206

integration_test.goH A D17-Aug-202195.5 KiB3,5433,067

iterator.goH A D17-Aug-202111.7 KiB363235

iterator_test.goH A D17-Aug-202111.4 KiB474425

job.goH A D17-Aug-202130.5 KiB1,005664

job_test.goH A D17-Aug-20212.4 KiB9676

load.goH A D17-Aug-20217.1 KiB199113

load_test.goH A D17-Aug-202110.8 KiB411384

model.goH A D17-Aug-20218.5 KiB278171

model_test.goH A D17-Aug-20213.2 KiB123103

nulls.goH A D17-Aug-20219 KiB383287

nulls_test.goH A D17-Aug-20214.5 KiB161135

oc_test.goH A D17-Aug-20211 KiB3918

params.goH A D17-Aug-202114.2 KiB478363

params_test.goH A D17-Aug-202113.1 KiB462413

query.goH A D17-Aug-202115.2 KiB430271

query_test.goH A D17-Aug-202114.5 KiB549508

random.goH A D17-Aug-20211.5 KiB5726

read_test.goH A D17-Aug-20216.7 KiB243203

routine.goH A D17-Aug-202111.7 KiB424328

routine_test.goH A D17-Aug-20214.7 KiB170149

schema.goH A D17-Aug-202118.8 KiB637407

schema_test.goH A D17-Aug-202128.2 KiB1,2071,129

standardsql.goH A D17-Aug-20215.3 KiB215162

standardsql_test.goH A D17-Aug-20212.9 KiB132112

table.goH A D17-Aug-202127.5 KiB876572

table_test.goH A D17-Aug-202112.2 KiB444414

value.goH A D17-Aug-202126 KiB954734

value_test.goH A D17-Aug-202134.9 KiB1,3281,210

README.md

1## BigQuery [![Go Reference](https://pkg.go.dev/badge/cloud.google.com/go/bigquery.svg)](https://pkg.go.dev/cloud.google.com/go/bigquery)
2
3- [About BigQuery](https://cloud.google.com/bigquery/)
4- [API documentation](https://cloud.google.com/bigquery/docs)
5- [Go client documentation](https://pkg.go.dev/cloud.google.com/go/bigquery)
6- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/bigquery)
7
8### Example Usage
9
10First create a `bigquery.Client` to use throughout your application:
11[snip]:# (bq-1)
12```go
13c, err := bigquery.NewClient(ctx, "my-project-ID")
14if err != nil {
15	// TODO: Handle error.
16}
17```
18
19Then use that client to interact with the API:
20[snip]:# (bq-2)
21```go
22// Construct a query.
23q := c.Query(`
24    SELECT year, SUM(number)
25    FROM [bigquery-public-data:usa_names.usa_1910_2013]
26    WHERE name = "William"
27    GROUP BY year
28    ORDER BY year
29`)
30// Execute the query.
31it, err := q.Read(ctx)
32if err != nil {
33	// TODO: Handle error.
34}
35// Iterate through the results.
36for {
37	var values []bigquery.Value
38	err := it.Next(&values)
39	if err == iterator.Done {  // from "google.golang.org/api/iterator"
40		break
41	}
42	if err != nil {
43		// TODO: Handle error.
44	}
45	fmt.Println(values)
46}
47```
48