Reputation: 10450
I’m running my DAG with configuration JSON, which includes parameters which includes -
, e.g. market-name
When I’m trying to read it using the following Jinja template:
path_prefix = f"market={{{{ params.market-name }}}}/configuration"
I’m getting the following error:
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'market'
It seems to me that Jinja doesn’t identify the full param name market-name but get the first part before the -
which is market .
My questions:
-
in the middle of a param (e.g. market-name
) or should I avoid it from the beginning and use market_name
instead?-
in the middle of a parammarket-name
?{{ params.market-name }}
instead of {{{{ params.market-name }}}}
?Upvotes: 0
Views: 867
Reputation: 15979
This is not Airflow bug. I reported it in this issue and this is a problem coming from Jinja/Python.
I could have not find any official documentation in Jinja that explains it but several reports mention that Jinja uses python interpreter's identifiers (see this answer and this answer). It might be best to report this issue to Jinja add documentation about it.
You can just avoid using -
.
Upvotes: 1