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

..03-May-2022-

benchmarks/H19-Nov-2019-10675

datatransfer/apiv1/H19-Nov-2019-2,4971,856

storage/apiv1beta1/H19-Nov-2019-986671

.repo-metadata.jsonH A D19-Nov-2019389 1312

CHANGES.mdH A D19-Nov-20191.2 KiB4627

README.mdH A D19-Nov-20191.2 KiB4743

bigquery.goH A D19-Nov-20194.8 KiB15799

bigquery.replayH A D19-Nov-2019928.5 KiB28,37628,376

copy.goH A D19-Nov-20193.2 KiB10865

copy_test.goH A D19-Nov-20194 KiB164144

dataset.goH A D19-Nov-201921.7 KiB731553

dataset_test.goH A D19-Nov-201914 KiB477429

doc.goH A D19-Nov-20199.5 KiB3091

error.goH A D19-Nov-20192.4 KiB8450

error_test.goH A D19-Nov-20192.6 KiB11086

examples_test.goH A D19-Nov-201920.2 KiB830609

external.goH A D19-Nov-201913.1 KiB408241

external_test.goH A D19-Nov-20193.7 KiB147124

extract.goH A D19-Nov-20193.5 KiB12076

extract_test.goH A D19-Nov-20193.3 KiB134111

file.goH A D19-Nov-20194.7 KiB13873

file_test.goH A D19-Nov-20192.5 KiB9978

gcs.goH A D19-Nov-20192.7 KiB7632

go.modH A D19-Nov-2019555 1815

go.sumH A D19-Nov-201917.1 KiB177176

go_mod_tidy_hack.goH A D19-Nov-2019919 232

inserter.goH A D19-Nov-20197.4 KiB248159

inserter_test.goH A D19-Nov-20195.6 KiB213187

integration_test.goH A D19-Nov-201970.3 KiB2,6602,329

iterator.goH A D19-Nov-20196.7 KiB223139

iterator_test.goH A D19-Nov-20198.9 KiB363325

job.goH A D19-Nov-201928.2 KiB918605

job_test.goH A D19-Nov-20192.4 KiB9676

load.goH A D19-Nov-20195.2 KiB15994

load_test.goH A D19-Nov-20199 KiB350323

model.goH A D19-Nov-20198.3 KiB270164

model_test.goH A D19-Nov-20193.2 KiB123103

nulls.goH A D19-Nov-20198.2 KiB349252

nulls_test.goH A D19-Nov-20192.4 KiB7654

oc_test.goH A D19-Nov-20191 KiB3918

params.goH A D19-Nov-201910.6 KiB371277

params_test.goH A D19-Nov-20199.5 KiB376332

query.goH A D19-Nov-201911.8 KiB335198

query_test.goH A D19-Nov-201912.2 KiB455419

random.goH A D19-Nov-20191.5 KiB5726

read_test.goH A D19-Nov-20196.5 KiB234194

routine.goH A D19-Nov-20199.6 KiB355271

routine_test.goH A D19-Nov-20194 KiB154133

schema.goH A D19-Nov-201915.6 KiB537356

schema_test.goH A D19-Nov-201925.7 KiB1,1351,060

standardsql.goH A D19-Nov-20194.4 KiB178131

standardsql_test.goH A D19-Nov-20192.9 KiB132112

table.goH A D19-Nov-201922.3 KiB723480

table_test.goH A D19-Nov-201911.3 KiB420390

value.goH A D19-Nov-201924 KiB895710

value_test.goH A D19-Nov-201933.2 KiB1,3021,184

README.md

1## BigQuery [![GoDoc](https://godoc.org/cloud.google.com/go/bigquery?status.svg)](https://godoc.org/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://godoc.org/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```