Templating of params dict values not working #18812
Answered
by
kaxil
raphaelauv
asked this question in
Q&A
-
Templating of values of the dict I have a file myquery.sql : CREATE OR REPLACE EXTERNAL TABLE {{params.project_id}}.{{params.dataset}}.{{params.tmp_table}} path_to_sql = "myquery.sql"
dag = DAG(dag_name,
schedule_interval="@daily",
template_searchpath=TEMPLATE_SEARCHPATH,
default_args=default_args)
class MyBigQueryExecuteQueryOperator(BigQueryExecuteQueryOperator):
template_fields = ("params",) + BigQueryExecuteQueryOperator.template_fields
MyBigQueryExecuteQueryOperator(
dag=dag,
task_id="something",
gcp_conn_id="a_conn",
sql=path_to_sql,
params={
"project_id": "{{ var.value.get('a_variable') }}",
"dataset": "toto",
"tmp_table": "aaaa_{date}".format(date="{{ ds_nodash }}"),
},
use_legacy_sql=False CREATE OR REPLACE EXTERNAL TABLE {{ var.value.get('a_variable') }}.toto.aaaa_{{ ds_nodash }} and not CREATE OR REPLACE EXTERNAL TABLE the_value_of_variable.toto.aaaa_2021..... Thank you very much |
Beta Was this translation helpful? Give feedback.
Answered by
kaxil
Oct 7, 2021
Replies: 2 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
raphaelauv
-
little hack to bypass |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
params
argument is not templated so you can not use Jinja template inparams
. This is the current limitation