BigQuery Load Error : Could not parse 'MM/DD/YYYY' as date for field shipped from CSV file
While loading CSV file with date values, bq load fails:
\n\nid,shipped,name\n0,1/10/2019,ryan\n2,10/1/2013,henry
\n\n\nError while reading data, error message: Could not parse '1/10/2019' as date for field shipped (position 1) starting at location 17
Solution:
While doing bq load only YYYY-MM-DD is supported:
\n\nWhen you load CSV or JSON data, values in DATE columns must use \nthe dash (-) separator and the date must be in the following \nformat: YYYY-MM-DD (year-month-day).\n
\n\nYou can,
\n\n- \n
- Load the CSV file as-is to BigQuery (i.e. convert the column to STRING datatype) \n
- Create a BigQuery view that transforms the
shipped
field from a string to a recognized date format. UseSELECT id, PARSE_DATE('%m/%d/%Y', shipped) AS shipped, name
\n - Use that view for your analysis
Ryan-Dallas
posted onEnjoy great content like this and a lot more !
Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds
Post Comment