How can I load a csv file into Bigquery using bq load command line tool while converting a microsecond timestamp into bq timestamp?
I'm using the following command:
bq load --skip_leading_rows=1 project1.partition_table "gs://data.csv.gz" ./schema.json
When loading this data into a new table with autodetect schema it works but bigquery makes an integer from the microsecond integer. When trying to add this file to this table it gives the error:
Waiting on bqjob_r65c10_1 ... (0s) Current status: DONE
BigQuery error in load operation: Error processing job 'skjfafq': Error while reading
data, error message: Could not parse '1611705599779000' as TIMESTAMP for field timestamp (position 2) starting at location 232 with message
'Epoch second value "1611705599779000" out of range'
Failure details:
- Error while reading data, error message: CSV processing encountered
too many errors, giving up. Rows: 1; errors: 1; max bad: 0; error
percent: 0
- query: Could not parse '1611705599779000' as TIMESTAMP for field
timestamp (position 2) starting at location 232 with message
'Epoch second value "1611705599779000" out of range'
- You are loading data without specifying data format, data will be
treated as CSV format by default. If this is not what you mean,
please specify data format by --source_format.
Is there a way to directly load files with microsecond timestamp into partitioned (by timestamp) bigquery tables? Or do I first need to load it into a temporary table and convert the value and copy into the partitioned table?