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

..11-Nov-2020-

benchmarks/H11-Nov-2020-397305

connection/H11-Nov-2020-1,4701,005

datatransfer/apiv1/H11-Nov-2020-2,7232,024

reservation/H11-Nov-2020-3,2002,160

storage/H11-Nov-2020-3,1512,057

CHANGES.mdH A D11-Nov-20203.3 KiB12579

README.mdH A D11-Nov-20201.2 KiB4743

bigquery.goH A D11-Nov-20205.9 KiB187117

bigquery.replayH A D11-Nov-2020928.5 KiB28,37628,376

copy.goH A D11-Nov-20203.2 KiB10865

copy_test.goH A D11-Nov-20204 KiB164144

dataset.goH A D11-Nov-202022.1 KiB740560

dataset_test.goH A D11-Nov-202014.1 KiB479431

doc.goH A D11-Nov-20209.9 KiB3171

error.goH A D11-Nov-20202.7 KiB10770

error_test.goH A D11-Nov-20203 KiB11591

examples_test.goH A D11-Nov-202020.2 KiB830609

external.goH A D11-Nov-202013.3 KiB412243

external_test.goH A D11-Nov-20203.7 KiB147124

extract.goH A D11-Nov-20204.1 KiB14693

extract_test.goH A D11-Nov-20204.9 KiB203175

file.goH A D11-Nov-20204.7 KiB13873

file_test.goH A D11-Nov-20202.5 KiB9978

gcs.goH A D11-Nov-20203 KiB8234

go.modH A D11-Nov-2020425 1613

go.sumH A D11-Nov-202052.4 KiB547546

go_mod_tidy_hack.goH A D11-Nov-2020919 232

iam.goH A D11-Nov-20204.1 KiB143105

iam_test.goH A D11-Nov-20201.6 KiB6646

inserter.goH A D11-Nov-20207.5 KiB249159

inserter_test.goH A D11-Nov-20205.6 KiB213187

integration_test.goH A D11-Nov-202081.9 KiB3,1022,692

iterator.goH A D11-Nov-202011.7 KiB363235

iterator_test.goH A D11-Nov-202011.4 KiB474425

job.goH A D11-Nov-202028 KiB915602

job_test.goH A D11-Nov-20202.4 KiB9676

load.goH A D11-Nov-20205.5 KiB16597

load_test.goH A D11-Nov-20209.6 KiB369342

model.goH A D11-Nov-20208.5 KiB278171

model_test.goH A D11-Nov-20203.2 KiB123103

nulls.goH A D11-Nov-20209 KiB383287

nulls_test.goH A D11-Nov-20204.5 KiB161135

oc_test.goH A D11-Nov-20201 KiB3918

params.goH A D11-Nov-202010.6 KiB371277

params_test.goH A D11-Nov-20209.5 KiB376332

query.goH A D11-Nov-202015.2 KiB430271

query_test.goH A D11-Nov-202014.5 KiB549508

random.goH A D11-Nov-20201.5 KiB5726

read_test.goH A D11-Nov-20206.7 KiB243203

routine.goH A D11-Nov-20209.9 KiB368283

routine_test.goH A D11-Nov-20204.3 KiB158137

schema.goH A D11-Nov-202016.9 KiB586394

schema_test.goH A D11-Nov-202027.2 KiB1,1691,092

standardsql.goH A D11-Nov-20204.4 KiB178131

standardsql_test.goH A D11-Nov-20202.9 KiB132112

table.goH A D11-Nov-202025.8 KiB822539

table_test.goH A D11-Nov-202012 KiB438408

value.goH A D11-Nov-202024.9 KiB922710

value_test.goH A D11-Nov-202033.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```