-
Notifications
You must be signed in to change notification settings - Fork 16.5k
Closed
Labels
affected_version:2.11Issues Reported for 2.10Issues Reported for 2.10area:corearea:data-aware-schedulingassets, datasets, AIP-48assets, datasets, AIP-48kind:bugThis is a clearly a bugThis is a clearly a bug
Milestone
Description
Apache Airflow version
2.11.0
If "Other Airflow 2 version" selected, which one?
No response
What happened?
Following the documentation on Attaching extra information to an emitting dataset event causes an incorrect warning to be emitted. (The warning is incorrect in the sense that it says the user did something they didn't actually do - which is pass a string as the last input.)
Code from the docs' example:
# Note that 3rd input, `alias`, isn't specified so it defaults to None.
yield Metadata(example_s3_dataset, {"row_count": len(df)})Then, in airflow/datasets/metadata.py, the branch that generates the warning is followed:
if isinstance(alias, DatasetAlias):
self.alias_name = alias.name
else: # This catches both `str` and `None`
warnings.warn(...What you think should happen instead?
The warning shouldn't say that a string (dataset uri) was passed instead of a Dataset object. Possibly, no warning should be emitted at all.
How to reproduce
Run the example from the docs verbatim.
Operating System
Linux
Versions of Apache Airflow Providers
No response
Deployment
Virtualenv installation
Deployment details
No response
Anything else?
Workaround
Provide a DatasetAlias(None) as the 3rd input to Metadata.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
affected_version:2.11Issues Reported for 2.10Issues Reported for 2.10area:corearea:data-aware-schedulingassets, datasets, AIP-48assets, datasets, AIP-48kind:bugThis is a clearly a bugThis is a clearly a bug