Jaison
Jaison

Reputation: 762

BigQuery - How to set the file stored in google cloud storage as schema file reference for BQ LOAD command?

I have placed json schema file and json data file in a bucket(mybucket) and trying to load the data into BigQuery using bq load command as below and it fails,

bq load --source_format=NEWLINE_DELIMITED_JSON --schema=gs://mybucket/Schema.json myds.myTable gs://mybucket/sourcedata.json

BigQuery error in load operation: Invalid value for: //MYBUCKET/SCHEMA.JSON is not a valid value

But the command works when i set the schema file path to local file system

bq load --source_format=NEWLINE_DELIMITED_JSON --schema=D:\\json\\Schema.json myds.myTable gs://mybucket/sourcedata.json

What am I doing wrong here?

Upvotes: 1

Views: 577

Answers (1)

Pentium10
Pentium10

Reputation: 208042

The complete commmand structure is

bq load [--source_format=NEWLINE_DELIMITED_JSON] [--project_id=your_project_id] destination_data_set.destination_table data_source_uri table_schema

bq load --project_id=my_project_bq dataset_name.bq_table_name gs://bucket_name/json_file_name.json path_to_schema_in_your_machine

Upvotes: 2

Related Questions