Mayank
Mayank

Reputation: 393

Google Big Query- Create Table Schema by CommandLine

I am trying to create table schema manually by command line in BigQuery

ref- https://cloud.google.com/bigquery/docs/schemas#specify-schema-manual-cli

My Command

bq load --source_format=CSV EncoreMarketingTest.SchemaTest1231 D:/myfile1.csv qtr:STRING,sales:FLOAT,year:STRING

It is giving below error, but if i pass only single parameter then its working fine:

Error:

 Upload complete.
Waiting on bqjob_r1d79e443_00000160c5b1e5d3_1 ... (0s) Current status: DONE
BigQuery error in load operation: Error processing job
'encoremarketingtest:bqjob_r1d79e443_00000160c5b1e5d3_1': Error while reading
data, error message: CSV table encountered too many errors, giving up. Rows: 1;
errors: 1.
Failure details:
- file-00000000: Error while reading data, error message: CSV table
references column position 1, but line starting at position:0
contains only 1 columns.

Could you please let me know the issue in command ?

Upvotes: 2

Views: 3164

Answers (1)

Graham Polley
Graham Polley

Reputation: 14791

You question has me a little confused, but I'm going to assume you are trying to create an empty table instead of trying to load a file/data.

You're using bq load. You should be using bq mk, for example:

bq mk --schema name:string,value:integer -t mydataset.newtable

See more info here.

Upvotes: 2

Related Questions