bigquery2jsonfile
v1.4.0
Published
Query bigquery to generate a properly typed json file
Downloads
18
Readme
bigquery2jsonfile
A program that just queries bigquery and output properly typed, no row limit JSON
I write this because the json generated by bq
is not properly typed and number of result rows is limited by default
usage
install
$ npm install bigquery2jsonfile
output to stdout
$ npx bigquery2jsonfile \
--sql ./path/to/query.sql \
--camelcase \
--project_id myproj-123456 \
--scope https://www.googleapis.com/auth/drive.readonly \
--service_account_credential_file ./path/to/credential.json
| jq -f /tmp/_.jq | jq -s \
| tee /tmp/_.json
| gsutil cp - gs://your-bucket-name/_.json
output to localfile
$ npx bigquery2jsonfile \
--sql ./path/to/query.sql \
--output ./path/to/output.json \
--camelcase \
--project_id myproj-123456 \
--scope https://www.googleapis.com/auth/drive.readonly \
--service_account_credential_file ./path/to/credential.json
output to google cloud storage
$ npx bigquery2jsonfile \
--sql ./path/to/query.sql \
--output gs://your-bucket-name/path/to/output.json \
--project_id myproj-123456 \
--scope https://www.googleapis.com/auth/drive.readonly \
--service_account_credential_file ./path/to/credential.json
use service account passed as a --service_account_credential_file
option for uploading