0
votes

I need a BigQueryOperator task like the following one: in which I need to save result from a query to a partitioned table. However, the "month_start" need to be derived from the actual DAG execution_date. I couldn't find any documents or examples on how to read the execution_date in my DAG definition script (in Python). Looking forward to some help here.

FYR: I'm with Airflow 1.8.2

 t1_invalid_geohash_by_traffic =  BigQueryOperator(
                                        task_id='invalid_geohash_by_traffic',
                                        bql='SQL/dangerous-area/InvalidGeohashByTraffic.sql',
                                        params = params,
                                        destination_dataset_table=
                                        'mydataset.mytable${}'.format(month_start),                                      write_disposition='WRITE_TRUNCATE',
                                        bigquery_conn_id=CONNECTION_ID,
                                        use_legacy_sql=False
                                    )
1

1 Answers