uranusjr commented on code in PR #25430:
URL: https://github.com/apache/airflow/pull/25430#discussion_r934216768


##########
airflow/providers/common/sql/hooks/sql.py:
##########
@@ -30,13 +30,10 @@
 from airflow.utils.module_loading import import_string
 from airflow.version import version
 
-if TYPE_CHECKING:
-    from sqlalchemy.engine import CursorResult
 
-
-def fetch_all_handler(cursor: 'CursorResult') -> Optional[List[Tuple]]:
+def fetch_all_handler(cursor) -> Optional[List[Tuple]]:
     """Handler for DbApiHook.run() to return results"""
-    if cursor.returns_rows:
+    if cursor.description is not None:
         return cursor.fetchall()

Review Comment:
   I am not sure how pymssql does things, but according to PEP 249, 
`description` does not offer the same functionality as SQLAlchemy’s 
`return_rows`. If `rowcount` does not either, you need to find another way that 
actually has a backing standard. Since DbApiHook should work for _all_ 
standard-compliant databases, we can’t rely on individual database behaviours, 
but must refer to the standard.



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