dstandish commented on issue #19096:
URL: https://github.com/apache/airflow/issues/19096#issuecomment-953232043


   Taking a look at this.  But first wanted to establish a workaround.  And 
this seems to work:
   
   ```python
   from datetime import datetime
   from typing import Any
   
   from airflow.models import DAG, BaseOperator
   
   
   dag = DAG("paramtest",
             start_date=datetime(2021, 1, 1),
             schedule_interval="@daily", catchup=False, 
user_defined_macros={'set': lambda x: set(x)})
   
   
   @dag.task(params={"a": [1, 2, 3], "b": [3, 4, 5]})
   def intersect(intersection):
       print(intersection)
   
   
   intersect("{{ set(params.a).intersection(params.b).pop() }}")
   ```
   
   Notice that you need to add `set` as a macro, because builtins are not 
available in jinja.  But this allows you to use those same set  operations in a 
template. 


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