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

..03-May-2022-

benchmarks/H02-Sep-2021-398305

connection/H02-Sep-2021-1,8551,259

datatransfer/apiv1/H02-Sep-2021-2,9882,213

reservation/H02-Sep-2021-3,8502,638

storage/H02-Sep-2021-9,6587,095

CHANGES.mdH A D02-Sep-202115.5 KiB243148

README.mdH A D02-Sep-20211.2 KiB4843

bigquery.goH A D02-Sep-20217.4 KiB240150

bigquery.replayH A D02-Sep-2021928.5 KiB28,37628,376

bigquery_test.goH A D02-Sep-20212.6 KiB128109

copy.goH A D02-Sep-20214.1 KiB12774

copy_test.goH A D02-Sep-20214.4 KiB186166

dataset.goH A D02-Sep-202122.1 KiB740560

dataset_test.goH A D02-Sep-202114.1 KiB479431

doc.goH A D02-Sep-20219.9 KiB3171

error.goH A D02-Sep-20212.7 KiB10770

error_test.goH A D02-Sep-20213 KiB11591

examples_test.goH A D02-Sep-202120.2 KiB830609

external.goH A D02-Sep-202117.5 KiB526307

external_test.goH A D02-Sep-20214.2 KiB166143

extract.goH A D02-Sep-20214.1 KiB14693

extract_test.goH A D02-Sep-20214.9 KiB203175

file.goH A D02-Sep-20215.1 KiB15386

file_test.goH A D02-Sep-20214.2 KiB174153

gcs.goH A D02-Sep-20213 KiB8234

go.modH A D02-Sep-2021571 2017

go.sumH A D02-Sep-202153.2 KiB545544

go_mod_tidy_hack.goH A D02-Sep-2021938 242

iam.goH A D02-Sep-20214.1 KiB143105

iam_test.goH A D02-Sep-20211.6 KiB6646

inserter.goH A D02-Sep-20217.5 KiB249159

inserter_test.goH A D02-Sep-20216.4 KiB236206

integration_test.goH A D02-Sep-202195.5 KiB3,5433,067

iterator.goH A D02-Sep-202111.7 KiB363235

iterator_test.goH A D02-Sep-202111.4 KiB474425

job.goH A D02-Sep-202130.5 KiB1,005664

job_test.goH A D02-Sep-20212.4 KiB9676

load.goH A D02-Sep-20217.1 KiB199113

load_test.goH A D02-Sep-202110.8 KiB411384

model.goH A D02-Sep-20218.5 KiB278171

model_test.goH A D02-Sep-20213.2 KiB123103

nulls.goH A D02-Sep-20219 KiB383287

nulls_test.goH A D02-Sep-20214.5 KiB161135

oc_test.goH A D02-Sep-20211 KiB3918

params.goH A D02-Sep-202114.2 KiB478363

params_test.goH A D02-Sep-202113.1 KiB462413

query.goH A D02-Sep-202115.2 KiB430271

query_test.goH A D02-Sep-202114.5 KiB549508

random.goH A D02-Sep-20211.5 KiB5726

read_test.goH A D02-Sep-20216.7 KiB243203

routine.goH A D02-Sep-202111.7 KiB424328

routine_test.goH A D02-Sep-20214.7 KiB170149

schema.goH A D02-Sep-202118.8 KiB637407

schema_test.goH A D02-Sep-202128.2 KiB1,2071,129

standardsql.goH A D02-Sep-20215.3 KiB215162

standardsql_test.goH A D02-Sep-20212.9 KiB132112

table.goH A D02-Sep-202127.5 KiB876572

table_test.goH A D02-Sep-202112.2 KiB444414

value.goH A D02-Sep-202126 KiB954734

value_test.goH A D02-Sep-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