potiuk commented on code in PR #32319:
URL: https://github.com/apache/airflow/pull/32319#discussion_r1421746096


##########
airflow/providers/databricks/hooks/databricks_sql.py:
##########
@@ -240,6 +240,13 @@ def run(
         else:
             return results
 
+    @staticmethod
+    def _make_serializable(result):
+        """Transform the databricks Row objects into a JSON-serializable list 
of rows."""
+        if result is not None:
+            return [list(row) for row in result]

Review Comment:
   Correct. Unfortunately - the DBAPIHook for it's backwards-compatibility 
reasons is pretty difficult to handle all cases - including the case where we 
either return  list of results or one result only.
   
   I tried to explain it in 
https://github.com/apache/airflow/blob/main/airflow/providers/common/sql/doc/adr/0002-return-common-data-structure-from-dbapihook-derived-hooks.md#decision
 (including all the possible variants of returned values) and I think our 
`handler` definition is not precise enough to explain that this can happen (we 
have not been as much into typing as we were back then).
   
   @Joffreybvn -> I think this means we have to hold -on with databricks/pyodbc 
implementation to add support for those cases. Will you have time to fix it 
quickly ? 



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