jens-scheffler-bosch commented on issue #33036:
URL: https://github.com/apache/airflow/issues/33036#issuecomment-1664633282

   Mhm, okay on my way home today I thought about the parameter 
`render_template_as_native_obj=True` in DAGs. Do you know about this?
   
   If you use this actually I assume the standard templating logic of Jinja 
could do all the same job via a `tojson` conversion, the following example did 
the same job like your proposal:
   
   ```
   with DAG(
       dag_id="docker",
       schedule="0 0 * * *",
       start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
       catchup=False,
       dagrun_timeout=datetime.timedelta(minutes=60),
       tags=["example", "example2"],
       params={
           "example_key": "example_value",
           "another_key": 1234,
       },
       render_template_as_native_obj=True,
   ) as dag:
       docker = DockerOperator(
           task_id="docker_test",
           image="alpine",
           command="env",
           environment="{{ params | tojson }}",
       )
   
       docker
   ```


-- 
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]

Reply via email to