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