Skip to content

Commit decd290

Browse files
committed
Added BigQuery database driver
1 parent dc26c41 commit decd290

13 files changed

+572
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SOURCE ?= file go_bindata github github_ee bitbucket aws_s3 google_cloud_storage godoc_vfs gitlab
2-
DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb yugabytedb clickhouse mongodb sqlserver firebird neo4j pgx
2+
DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb yugabytedb clickhouse mongodb sqlserver firebird neo4j pgx bigquery
33
DATABASE_TEST ?= $(DATABASE) sqlite sqlite3 sqlcipher
44
VERSION ?= $(shell git describe --tags 2>/dev/null | cut -c 2-)
55
TEST_FLAGS ?=

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Database drivers run migrations. [Add a new database?](database/driver.go)
4242
* [ClickHouse](database/clickhouse)
4343
* [Firebird](database/firebird)
4444
* [MS SQL Server](database/sqlserver)
45+
* [BigQuery (Beta)](database/bigquery)
4546

4647
### Database URLs
4748

database/bigquery/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tmp/
2+
!tmp/.gitkeep

database/bigquery/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# BigQuery (Beta)
2+
3+
* Driver works with Google Cloud BigQuery
4+
* [Examples](./examples)
5+
6+
### Usage
7+
`bigquery://https://www.googleapis.com/bigquery/v2:443?x-migrations-table=schema_migrations&x-statement-timeout=0&credentials_filename=./myproject-XXXXXXXXXXXXX-XXXXXXXXXXXX.json&project_id=myproject-XXXXXXXXXXXXX&dataset_id=mydataset`
8+
9+
10+
### System variables reference
11+
https://cloud.google.com/bigquery/docs/reference/system-variables
12+
13+
| Key | WithInstance Config | Default | Description |
14+
|--------------------------|---------------------|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15+
| `x-migrations-table` | `MigrationsTable` | schema_migrations | Name of the migrations table |
16+
| `x-statement-timeout` | `StatementTimeout` | 0 | Abort any statement that takes more than the specified number of milliseconds |
17+
| `credentials_filename` | - | - | The location of a credential JSON file. |
18+
| `project_id` | - | - | The current Google Cloud project ID. |
19+
| `dataset_id` | `DatasetID` | - | ID of the default dataset in the current project. This ID is used when a dataset is not specified for a project in the query. You can use the SET statement to assign @@dataset_id to another dataset ID in the current project. The system variables @@dataset_project_id and @@dataset_id can be set and used together. |
20+
| `dataset_project_id` | `DatasetProjectID` | the same as `project_id` | ID of the default project that's used when one is not specified for a dataset used in the query. If @@dataset_project_id is not set, or if it is set to NULL, the query-executing project (@@project_id) is used. You can use the SET statement to assign @@dataset_project_id to another project ID. The system variables @@dataset_project_id and @@dataset_id can be set and used together. |
21+
| `query_label` | `QueryLabel` | NULL | Query label to associate with query jobs in the current multi-statement query or session. If set in a query, all subsequent query jobs in the script or session will have this label. If not set in a query, the value for this system variable is NULL. For an example of how to set this system variable, see Associate jobs in a session with a label. |
22+
| `time_zone` | `TimeZone` | UTC | The default time zone to use in time zone-dependent SQL functions, when a time zone is not specified as an argument. @@time_zone can be modified by using a SET statement to any valid time zone name. At the start of each script, @@time_zone begins as “UTC”. |
23+
24+
25+
26+
### Environment variables:
27+
- https://cloud.google.com/docs/authentication/application-default-credentials#GAC
28+
29+
| Key | Description |
30+
|--------------------------------|--------------------------------------------------|
31+
| GOOGLE_APPLICATION_CREDENTIALS | The location of a credential JSON file. |
32+
33+
34+
### Data definition language (DDL) statements in Google Standard SQL
35+
https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language
36+
37+
38+
### Work with multi-statement queries
39+
https://cloud.google.com/bigquery/docs/multi-statement-queries
40+

0 commit comments

Comments
 (0)