I have a column with date format as "month_name day, yyyy", for example, "July 4, 2000". Now I want to convert it to ISO "yyyy-mm-dd". Is there any function I can call to do it in standard SQL?
UPDATE target_name
SET col = function(col)
How do I use python client to update a column with the above function or update a new column using the function after creating it as below ?
original_schema = table.schema
new_schema = original_schema[:]
new_schema.append(bigquery.SchemaField('new_date', 'DATE'))
table.schema = new_schema
table = client.update_table(table, ['schema'])
Thanks!
您可以使用日期函数: parse_date()
将字符串转换为date
,然后format_date()
将date
转换为所需格式的字符串:
update target_name set col = format_date('%F', parse_date('%B %e, %Y', col))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.