Airflow 在BigQueryOperator中将参数添加为模板_字段

Airflow 在BigQueryOperator中将参数添加为模板_字段,airflow,Airflow,我正试图在Bigquery操作符中模板化params字段,如下所示 t3 = MyBigQueryOperator( task_id='autoplay_calc', bql='autoplay_calc.sql', params={ "env" : deployment ,"region" : region ,"partition_start_date" : '{{ macros.ds_add(ds

我正试图在Bigquery操作符中模板化params字段,如下所示

t3 = MyBigQueryOperator(
    task_id='autoplay_calc',
    bql='autoplay_calc.sql',
    params={
            "env" : deployment
            ,"region" : region
            ,"partition_start_date" : '{{ macros.ds_add(ds, -1) }}'
            },
    bigquery_conn_id='gcp_conn',
    use_legacy_sql=False,
    write_disposition='WRITE_APPEND',
    allow_large_results=True,
    provide_context=True,
    destination_dataset_table=reporting_project + '.pa_reporting_public_batch.autoplay_calc',
    dag=dag
    )
我意识到params不是模板化字段,因此我扩展了Bigqueryoperator,如下所示,使其成为模板化字段

class MyBigQueryOperator(BigQueryOperator):
    template_fields = ('params', 'bql', 'destination_dataset_table')
但是,当我运行代码时,当我收到下面的错误消息时,它似乎没有转换params字段

Could not cast literal "{{ macros.ds_add(ds, -1) }}

简短回答:
params
不支持模板化,因为它是一个字典,需要将jinja2应用于键值对。您不能仅通过扩展
template\u字段
属性来添加支持