CertKeen

Google Cloud Associate Cloud Engineer · Free practice question 7 of 12

bq load CSV into a table

An analyst at Thistle Grocers must load the file gs://thistle-exports/sales.csv, which has a header row, into the BigQuery table retail.sales_raw with schema auto-detection. Which command should she run?

  1. A.bq cp gs://thistle-exports/sales.csv retail.sales_raw
  2. B.bq query --destination_table=retail.sales_raw gs://thistle-exports/sales.csv
  3. C.bq extract retail.sales_raw gs://thistle-exports/sales.csv
  4. D.bq load --source_format=CSV --skip_leading_rows=1 --autodetect retail.sales_raw gs://thistle-exports/sales.csv
Show answer and explanation

Correct answer: D. bq load --source_format=CSV --skip_leading_rows=1 --autodetect retail.sales_raw gs://thistle-exports/sales.csv

Why: bq load imports data from Cloud Storage into a table, and the flags set the CSV format, skip the header row and infer the schema. bq query runs SQL rather than loading files, bq cp copies tables, and bq extract exports a table to Cloud Storage, the opposite direction.

More free Google Cloud Associate Cloud Engineer questions