anasatzemoso commented on issue #50631:
URL: https://github.com/apache/airflow/issues/50631#issuecomment-3144498523

   BashOperator expect their arguments to be concrete values at DAG parse time. 
It does not know how to resolve these placeholders at runtime, so they either 
print the placeholder or fail. 
   
   I tried with @task.bash() & also used PythonOperator they both worked fine 
as they are designed to resolve mapped arguments at runtime, whereas 
bashoperator inside task group is not mapping aware and cannot handle dynamic 
values.
   
   ```
   from airflow import DAG
   from airflow.decorators import task,
   from pendulum import datetime
   
   with DAG(
       dag_id="bash_issue_test",
       start_date=datetime(2025, 8, 1, tz='UTC'),
       catchup=False,
       schedule="@daily"
   ) as dag:
   
       @task()
       def list_dict_generator():
           my_list = [
               {
                   "project": "my_project",
                   "dataset": f"dataset_{number}",
                   "table_name": "my_table",
                   "partition_id": "my_partition_id",
               }
               for number in range(10)
           ]
           return my_list
   
       @task.bash()
       def echo_cmd(project, dataset, table_name, partition_id):
           return f'echo "Partition: 
{project}.{dataset}.{table_name}${partition_id}"'
   
       echo_cmd.expand_kwargs(list_dict_generator())
   ```
   


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