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

..01-Mar-2021-

benchmarks/H01-Mar-2021-397305

connection/H01-Mar-2021-1,5931,128

datatransfer/apiv1/H01-Mar-2021-2,8132,113

reservation/H01-Mar-2021-3,4282,388

storage/H01-Mar-2021-3,3502,258

CHANGES.mdH A D01-Mar-20214.9 KiB14991

README.mdH A D01-Mar-20211.2 KiB4743

bigquery.goH A D01-Mar-20215.9 KiB187117

bigquery.replayH A D01-Mar-2021928.5 KiB28,37628,376

copy.goH A D01-Mar-20213.2 KiB10865

copy_test.goH A D01-Mar-20214 KiB164144

dataset.goH A D01-Mar-202122.1 KiB740560

dataset_test.goH A D01-Mar-202114.1 KiB479431

doc.goH A D01-Mar-20219.9 KiB3171

error.goH A D01-Mar-20212.7 KiB10770

error_test.goH A D01-Mar-20213 KiB11591

examples_test.goH A D01-Mar-202120.2 KiB830609

external.goH A D01-Mar-202115.9 KiB484281

external_test.goH A D01-Mar-20213.9 KiB155132

extract.goH A D01-Mar-20214.1 KiB14693

extract_test.goH A D01-Mar-20214.9 KiB203175

file.goH A D01-Mar-20214.7 KiB13873

file_test.goH A D01-Mar-20212.5 KiB9978

gcs.goH A D01-Mar-20213 KiB8234

go.modH A D01-Mar-2021567 1916

go.sumH A D01-Mar-202143.2 KiB441440

go_mod_tidy_hack.goH A D01-Mar-2021919 232

iam.goH A D01-Mar-20214.1 KiB143105

iam_test.goH A D01-Mar-20211.6 KiB6646

inserter.goH A D01-Mar-20217.5 KiB249159

inserter_test.goH A D01-Mar-20216.4 KiB236206

integration_test.goH A D01-Mar-202185.4 KiB3,2192,786

iterator.goH A D01-Mar-202111.7 KiB363235

iterator_test.goH A D01-Mar-202111.4 KiB474425

job.goH A D01-Mar-202128.7 KiB938618

job_test.goH A D01-Mar-20212.4 KiB9676

load.goH A D01-Mar-20215.5 KiB16597

load_test.goH A D01-Mar-20219.6 KiB369342

model.goH A D01-Mar-20218.5 KiB278171

model_test.goH A D01-Mar-20213.2 KiB123103

nulls.goH A D01-Mar-20219 KiB383287

nulls_test.goH A D01-Mar-20214.5 KiB161135

oc_test.goH A D01-Mar-20211 KiB3918

params.goH A D01-Mar-202110.9 KiB376279

params_test.goH A D01-Mar-20219.5 KiB376332

query.goH A D01-Mar-202115.2 KiB430271

query_test.goH A D01-Mar-202114.5 KiB549508

random.goH A D01-Mar-20211.5 KiB5726

read_test.goH A D01-Mar-20216.7 KiB243203

routine.goH A D01-Mar-202111.1 KiB400306

routine_test.goH A D01-Mar-20214.4 KiB160139

schema.goH A D01-Mar-202117.4 KiB594396

schema_test.goH A D01-Mar-202127.4 KiB1,1711,094

standardsql.goH A D01-Mar-20214.4 KiB178131

standardsql_test.goH A D01-Mar-20212.9 KiB132112

table.goH A D01-Mar-202125.8 KiB822539

table_test.goH A D01-Mar-202112 KiB438408

value.goH A D01-Mar-202126 KiB954734

value_test.goH A D01-Mar-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 {
40		break
41	}
42	if err != nil {
43		// TODO: Handle error.
44	}
45	fmt.Println(values)
46}
47```