如何将特定的日期格式加载到BigQuery中

如何将特定的日期格式加载到BigQuery中

问题描述:

在将日期为DD/MM/YY的日期将.csv文件加载到 BigQuery 中时,如果我为表格指定了架构并选择了日期格式,则此操作将无效.

When loading a .csv file into BigQuery with dates with this format DD/MM/YY it doesn't work, if I specify the schema for the table and I select Date Format.

但是,如果我未指定架构,而是选择自动检测,它将起作用并将日期格式转换为YYYY-MM-DD.

However, if I don't specify the schema and I choose Automatically detect it works and converts the date format into YYYY-MM-DD.

是否有可能将日期手动转换为正确的格式并为该字段指定名称?

Is there any possibility of convert the date into the right format manually and specify the name for that field?

谢谢, 大卫

不幸的是,无法通过加载API控制日期格式.您可以先将数据加载到STRING中,然后使用Standard SQL的PARSE_DATE函数以任何自定义格式解析数据.

Unfortunatelly, there is no way to control date formatting from the load API. You can load data into STRING first, and then use Standard SQL's PARSE_DATE function to parse it using any custom format.