kacpermuda commented on code in PR #74805:
URL: https://github.com/apache/airflow/pull/74805#discussion_r4379808481


##########
providers/common/sql/src/airflow/providers/common/sql/operators/sql.py:
##########
@@ -297,11 +297,8 @@ def get_openlineage_facets_on_start(self) -> 
OperatorLineage | None:
             use_external_connection = True
 
         connection = hook.get_connection(getattr(hook, hook.conn_name_attr))
-        try:
-            database_info = hook.get_openlineage_database_info(connection)
-        except AttributeError:
-            self.log.debug("%s has no database info provided", hook)
-            database_info = None
+        get_database_info = getattr(hook, "get_openlineage_database_info", 
None)
+        database_info = get_database_info(connection) if get_database_info is 
not None else None

Review Comment:
   Agreed, that was too much collateral. I took your suggestion. The 
get_openlineage_database_info call in the operator and in 
get_openlineage_facets_with_sql now catches Exception, logs a WARNING 
(traceback at debug) and falls back to None. A hook that doesn’t define the 
method is detected with getattr and stays silent. Database-specific lineage, 
check facets and the GCS output fallback keep working. Tests cover that 
get_openlineage_facets_on_complete still returns the database-specific lineage 
after the database info lookup fails.



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