Skip to content

Commit

Permalink
Create BigLake: Qwik Start
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayush7-BIT authored Jul 19, 2023
1 parent 805b66f commit 0f2687e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions BigLake: Qwik Start
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
bq mk --connection --location=US --project_id=$DEVSHELL_PROJECT_ID \
--connection_type=CLOUD_RESOURCE my-connection
SERVICE_ACCOUNT_ID=$(bq show --format=json --connection $DEVSHELL_PROJECT_ID.US.my-connection | jq -r '.cloudResource.serviceAccountId')
gcloud projects add-iam-policy-binding $DEVSHELL_PROJECT_ID --member="serviceAccount:$SERVICE_ACCOUNT_ID" --role="roles/storage.objectViewer"
bq mk demo_dataset
bq mkdef --source_format=CSV --autodetect=true \
gs://$DEVSHELL_PROJECT_ID/customer.csv > mytable_def
bq mk --table --external_table_definition=mytable_def \
demo_dataset.biglake_table
bq mkdef --source_format=CSV --autodetect=true \
gs://$DEVSHELL_PROJECT_ID/invoice.csv > mytable_deff
bq mk --table --external_table_definition=mytable_deff \
demo_dataset.external_table
bq mkdef \
--autodetect \
--connection_id=$DEVSHELL_PROJECT_ID.US.my-connection \
--source_format=CSV \
"gs://$DEVSHELL_PROJECT_ID/invoice.csv" > /tmp/tabledef.json
bq show --schema --format=prettyjson demo_dataset.external_table > /tmp/schema
bq update --external_table_definition=/tmp/tabledef.json --schema=/tmp/schema demo_dataset.external_table

0 comments on commit 0f2687e

Please sign in to comment.