Created
July 11, 2022 18:08
-
-
Save brunopk/04afbba26b5d24aecc7777c7c325792d to your computer and use it in GitHub Desktop.
Bigquery
gcloud config set project project_name
bq show dataset.table
or:
bq show --format=prettyjson dataset.table
to get information in JSON format.
bq mk -t \
--schema 'schema.json' \
--time_partitioning_field partitioned_field \
--time_partitioning_type DAY \
--clustering_fields field_c \
project:dataset.table
The schema should be a JSON list:
[{
"description": "description",
"maxLength": "150",
"mode": "REQUIRED",
"name": "field_c",
"type": "STRING"
}, {
"description": "description",
"mode": "REQUIRED",
"name": "partitioned_field",
"type": "TIMESTAMP"
}]
First set the project:
gcloud config set project project_name
bq query --destination_table dataset.destination_table \
--use_legacy_sql=false \
'SELECT * FROM other_project.other_dataset.other_table'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment