Lee-W commented on code in PR #32319:
URL: https://github.com/apache/airflow/pull/32319#discussion_r1251834471
##########
airflow/providers/odbc/hooks/odbc.py:
##########
@@ -211,3 +215,9 @@ def get_sqlalchemy_connection(
engine = self.get_sqlalchemy_engine(engine_kwargs=engine_kwargs)
cnx = engine.connect(**(connect_kwargs or {}))
return cnx
+
+ def _make_serializable(self, result: list[pyodbc.Row]) -> list[tuple] |
list[pyodbc.Row]:
Review Comment:
nitpick: Should the return type be annotated this one?
```suggestion
def _make_serializable(self, result: list[pyodbc.Row]) ->
list[tuple[pyodbc.Row]] | list[pyodbc.Row]:
```
##########
airflow/providers/common/sql/hooks/sql.py:
##########
@@ -372,6 +372,15 @@ def run(
else:
return results
+ def _make_serializable(self, result: Any) -> Any:
+ """Ensure the data returned from a SQL command is JSON-serializable.
+
+ This method is intended to be overridden by subclasses of the
+ `DbApiHook`. Its purpose is to transform the result of a SQL command
+ into a JSON-serializable format.
Review Comment:
What should happen if this is not overridden? If we don't want the user do
not override it, should we add an exception here? If it's ok that we return the
original input as output, could we add this behavior to the docstring?
--
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]