Taragolis commented on issue #16892:
URL: https://github.com/apache/airflow/issues/16892#issuecomment-2042189581
I guess the original problem with mapping keys are:
1. Keys should be hashable
2. It should be unique
Some simple snippet for demonstrate
```python
from jinja2 import Environment
from jinja2.nativetypes import NativeEnvironment
dups_keys = {
"a": "{{ 'foo' }}",
"{{ 'a' }}": "bar",
}
print(f"Original: {dups_keys}")
env = Environment()
rendered_value = {
env.from_string(k).render(): env.from_string(v).render()
for k, v in dups_keys.items()
}
print(f"Rendered: {rendered_value}")
non_hashable_keys = {
"{{ spam }}": "{{ spam }}",
}
print(f"Original: {non_hashable_keys}")
nenv = NativeEnvironment()
rendered_value = {
nenv.from_string(k).render(spam=["a"]):
nenv.from_string(v).render(spam=["a"])
for k, v in non_hashable_keys.items()
}
print(f"Rendered: {non_hashable_keys}")
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]