0
votes

I have an actual bigquery table with a datetime column, and i want to split this datetime in other columns such as : year, month, day, quarter

I have succeeded the extract with the query :

SELECT date, EXTRACT(YEAR FROM date) as year, EXTRACT(MONTH FROM date) as month, EXTRACT(QUARTER FROM date) as quarter FROM 'project.dataset.table' ;

How to get the result and update the table by creating the new year/month/quarter columns ?

I tried the method : SET year = EXTRACT(YEAR FROM date) WHERE TRUE

but it didn't work

1
Did you read the documentation? Was something unclear?Elliott Brossard
@ElliottBrossard in fact i wish i could do my transformation with a query because i have to use it again in a SQLoperator in airflowuser2019

1 Answers