Lee-W commented on code in PR #44639:
URL: https://github.com/apache/airflow/pull/44639#discussion_r1875546378
##########
airflow/utils/context.py:
##########
@@ -161,54 +178,89 @@ class OutletEventAccessor:
:meta private:
"""
- raw_key: str | Asset | AssetAlias
+ key: str | BaseAssetUniqueKey
extra: dict[str, Any] = attrs.Factory(dict)
asset_alias_events: list[AssetAliasEvent] = attrs.field(factory=list)
- def add(self, asset: Asset | str, extra: dict[str, Any] | None = None) ->
None:
+ def add(self, asset: str | Asset, extra: dict[str, Any] | None = None) ->
None:
"""Add an AssetEvent to an existing Asset."""
if isinstance(asset, str):
- asset_uri = asset
- elif isinstance(asset, Asset):
- asset_uri = asset.uri
- else:
+ asset = Asset(asset)
+ elif not isinstance(asset, Asset):
return
- if isinstance(self.raw_key, str):
- asset_alias_name = self.raw_key
- elif isinstance(self.raw_key, AssetAlias):
- asset_alias_name = self.raw_key.name
+ if isinstance(self.key, AssetAliasUniqueKey):
+ asset_alias_name = self.key.name
+ elif isinstance(self.key, str):
+ # TODO: deprecate string access
+ asset_alias_name = self.key
Review Comment:
Yep,
https://github.com/apache/airflow/blob/99e713efa398bef9d76eb4e8145538e828a05720/airflow/utils/context.py#L227
has already deprecate it
--
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]