tree: ab00be1c1bb2c703c9db6a9c0de551d0321ec9a1 [path history] [tgz]
  1. README.md
  2. benchmarks/
  3. bigquery.go
  4. bigquery.replay
  5. copy.go
  6. copy_test.go
  7. dataset.go
  8. dataset_test.go
  9. datatransfer/
  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. routine.go
  42. routine_test.go
  43. schema.go
  44. schema_test.go
  45. standardsql.go
  46. standardsql_test.go
  47. storage/
  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)
}