dabla commented on code in PR #61144:
URL: https://github.com/apache/airflow/pull/61144#discussion_r2738059158
##########
providers/oracle/src/airflow/providers/oracle/hooks/oracle.py:
##########
@@ -63,6 +64,43 @@ def _get_first_bool(*vals):
return None
+def _safe_read(val):
+ if val is not None and callable(getattr(val, "read", None)):
+ return val.read()
+ return val
+
+
+def _safe_read_row(row):
+ if row is not None:
+ return tuple([_safe_read(value) for value in row])
+ return row
+
+
+def fetch_all_handler(cursor) -> list[tuple] | None:
+ """Return results for DbApiHook.run()."""
+ if not hasattr(cursor, "description"):
+ raise RuntimeError(
+ "The database we interact with does not support DBAPI 2.0. Use
operator and "
+ "handlers that are specifically designed for your database."
+ )
+ if cursor.description is not None:
+ results = [_safe_read_row(row) for row in cursor.fetchall()]
+ return results
+ return None
+
+
+def fetch_one_handler(cursor) -> list[tuple] | None:
Review Comment:
Yeah saw that too, original one is also wrong then in sql module, will fix
it there also.
--
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]