tree: 4846df5dea70c0b4b3403a79fcc1dc2865617265 [path history] [tgz]
  1. benchmarks/
  2. datatransfer/
  3. storage/
  4. bigquery.go
  5. bigquery.replay
  6. copy.go
  7. copy_test.go
  8. dataset.go
  9. dataset_test.go
  10. doc.go
  11. error.go
  12. error_test.go
  13. examples_test.go
  14. external.go
  15. external_test.go
  16. extract.go
  17. extract_test.go
  18. file.go
  19. file_test.go
  20. gcs.go
  21. inserter.go
  22. inserter_test.go
  23. integration_test.go
  24. iterator.go
  25. iterator_test.go
  26. job.go
  27. job_test.go
  28. load.go
  29. load_test.go
  30. model.go
  31. model_test.go
  32. nulls.go
  33. nulls_test.go
  34. oc_test.go
  35. params.go
  36. params_test.go
  37. query.go
  38. query_test.go
  39. random.go
  40. read_test.go
  41. README.md
  42. routine.go
  43. routine_test.go
  44. schema.go
  45. schema_test.go
  46. standardsql.go
  47. standardsql_test.go
  48. table.go
  49. table_test.go
  50. value.go
  51. value_test.go
bigquery/README.md

BigQuery GoDoc

Example Usage

First create a bigquery.Client to use throughout your application: [snip]:# (bq-1)

c, err := bigquery.NewClient(ctx, "my-project-ID")
if err != nil {
	// TODO: Handle error.
}

Then use that client to interact with the API: [snip]:# (bq-2)

// Construct a query.
q := c.Query(`
    SELECT year, SUM(number)
    FROM [bigquery-public-data:usa_names.usa_1910_2013]
    WHERE name = "William"
    GROUP BY year
    ORDER BY year
`)
// Execute the query.
it, err := q.Read(ctx)
if err != nil {
	// TODO: Handle error.
}
// Iterate through the results.
for {
	var values []bigquery.Value
	err := it.Next(&values)
	if err == iterator.Done {
		break
	}
	if err != nil {
		// TODO: Handle error.
	}
	fmt.Println(values)
}