Issues loading CSV into BigQuery table

久未见 提交于 2020-01-16 14:31:30

问题


Im trying to create a BigQuery table using a pretty simple csv file I have stored in GCS. I keep getting the same error over and over again:

Could not parse '1/1/2008' as datetime for field XXX 

I've checked that the csv file isn't corrupted, and I've managed to upload everything into one column so the file is readable by BigQuery.

I've added the word NULL to any empty fields thinking consecutive delimiters may be causing the issues but I am still facing the same issue.

I know data, I understand data and CSV files.


回答1:


BigQuery cannot cast '1/1/2008' as DATETIME and rather would expecting something like '2008-1-1'

So, you can either modify your CSV file or just use STRING for that XXX field and than translate it into DATETIME in your queries - like below

#standardSQL
SELECT PARSE_DATETIME('%d/%m/%Y', '1/1/2008')


来源:https://stackoverflow.com/questions/49039079/issues-loading-csv-into-bigquery-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!