darkag commented on issue #32993:
URL: https://github.com/apache/airflow/issues/32993#issuecomment-1664597187
It seems that operator run directly the hook's run function passing the
fetch_all_handler as default, but it should work doing something like this for
vertica hook:
```python
from airflow.providers.common.sql.hooks.sql import DbApiHook,
fetch_all_handler
def vertica_fetch_all_handler(cursor) -> list[tuple] | None:
to_return = fetch_all_handler(cursor)
while cursor.nextset(): #loop on all statement result to get errors
cursor.fetchall()
return to_return
class VerticaHook(DbApiHook):
"""Interact with Vertica."""
def run(
self,
sql: str | Iterable[str],
autocommit: bool = False,
parameters: Iterable | Mapping | None = None,
handler: Callable | None = None,
split_statements: bool = False,
return_last: bool = True,
) -> Any | list[Any] | None:
if(handler == fetch_all_handler):
handler = vertica_fetch_all_handler
return DbApiHook.run(self, sql, autocommit, parameters,
split_statements, return_last)
```
I'll try to make test with this code tomorrow but I will not have time to
make a PR for the moment.
--
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]