【问题标题】:Apache Airflow - BigQueryOperator: How to dynamically set destination_dataset_table partitionApache Airflow - BigQueryOperator:如何动态设置destination_dataset_table 分区
【发布时间】:2017-10-23 14:20:50
【问题描述】:

我需要一个 BigQueryOperator 任务,如下所示:我需要将查询结果保存到分区表中。但是,"month_start" 需要从实际的 DAG execution_date 派生。我在我的 DAG 定义脚本(在 Python 中)中找不到有关如何读取 execution_date 的任何文档或示例。期待在这里得到一些帮助。

FYR:我使用 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
                                    )

【问题讨论】:

    标签: airflow apache-airflow


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 2018-11-03
      • 2018-11-07
      • 1970-01-01
      • 2018-06-20
      • 1970-01-01
      • 1970-01-01
      • 2017-03-10
      • 2011-11-26
      • 1970-01-01
      相关资源
      最近更新 更多