tatiana opened a new pull request, #30943:
URL: https://github.com/apache/airflow/pull/30943
If the user attempted to use dynamic task mapping with an operator that had
a template field which mapped pandas DataFrames, they would get the error:
```
tests/models/test_mappedoperator.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
airflow/utils/session.py:76: in wrapper
return func(*args, session=session, **kwargs)
airflow/models/dag.py:2688: in test
_run_task(ti, session=session)
airflow/models/dag.py:3807: in _run_task
ti._run_raw_task(session=session)
airflow/utils/session.py:73: in wrapper
return func(*args, **kwargs)
airflow/models/taskinstance.py:1453: in _run_raw_task
self._execute_task_with_callbacks(context, test_mode)
airflow/models/taskinstance.py:1577: in _execute_task_with_callbacks
task_orig = self.render_templates(context=context)
airflow/models/taskinstance.py:2227: in render_templates
original_task.render_template_fields(context)
airflow/models/mappedoperator.py:699: in render_template_fields
unmapped_task._do_render_template_fields(
airflow/utils/session.py:73: in wrapper
return func(*args, **kwargs)
airflow/models/abstractoperator.py:567: in _do_render_template_fields
if not value:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
self = x
a 1
b 2
c 3
@final
def __nonzero__(self) -> NoReturn:
> raise ValueError(
f"The truth value of a {type(self).__name__} is ambiguous. "
"Use a.empty, a.bool(), a.item(), a.any() or a.all()."
)
E ValueError: The truth value of a DataFrame is ambiguous. Use
a.empty, a.bool(), a.item(), a.any() or a.all().
/usr/local/lib/python3.8/site-packages/pandas/core/generic.py:1527:
ValueError
```
This pull request adds a test for this use-case and the fix.
closes: https://github.com/astronomer/astro-sdk/issues/1911
--
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]