Lee-W commented on code in PR #41325:
URL: https://github.com/apache/airflow/pull/41325#discussion_r1837546875


##########
airflow/utils/context.py:
##########
@@ -281,10 +289,13 @@ def __getitem__(self, key: int | str | Asset | 
AssetAlias) -> LazyAssetEventSele
             asset_alias = self._asset_aliases[obj.name]
             join_clause = AssetEvent.source_aliases
             where_clause = AssetAliasModel.name == asset_alias.name
-        elif isinstance(obj, (Asset, str)):
+        elif isinstance(obj, (Asset, AssetRef)):
+            join_clause = AssetEvent.asset
+            where_clause = AssetModel.name == self._assets[obj.name].name
+        elif isinstance(obj, str):
             asset = self._assets[extract_event_key(obj)]
             join_clause = AssetEvent.asset
-            where_clause = AssetModel.uri == asset.uri
+            where_clause = AssetModel.name == asset.name

Review Comment:
   If we agree to remove it, here's what I'm thinking.
   
   1. Create another PR on `v2-10-test` that adds a deprecated warning for 
accessing the outlet through `str` 
   2. Review how Assets are handled in outlets and create another PR or combine 
it with https://github.com/apache/airflow/pull/43774 (name, group, URI are not 
correctly handled in some places)



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