22 Sep 21 ·  mCollins in Bigquery ·        Bookmark ·  Report ·  More actions.. Lock comments ·  Pin thread

BigQuery bq load examples

Use the bq load command to load data into table

Loading CSV File

Load with auto detect schema from UNIX

bq load --autodetect --field_delimiter="," project:myDataset.myTable ./myFile.csv

Load with auto detect schema from Windows

bq load --autodetect --field_delimiter="," project:myDataset.myTable "C:\Data\myFile.csv"

Load with auto detect schema from GCS

bq load --autodetect --field_delimiter="," project:myDataset.myTable gs://bucketname/myFile.cvs

Load with explicit schema

bq load myDataset.newTable gs://mybucket/info.csv ./info_schema.json

Loading AVRO File

bq load --autodetect --source_format=AVRO project:myDataset.myTable ./myFile.avro
bq load --autodetect --source_format=AVRO project:myDataset.myTable gs://bucketnm/myFile.avro

Loading Parquet File

bq load --autodetect --source_format=PARQUET project:myDataset.myTable ./myFile.parquet
bq load --autodetect --source_format=PARQUET project:myDataset.myTable gs://bucketnm/myFile.parquet

Loading JSON File

bq load --autodetect --source_format=NEWLINE_DELIMITED_JSON project:myDataset.myTable ./myFile.json