potiuk commented on code in PR #23971:
URL: https://github.com/apache/airflow/pull/23971#discussion_r922718852
##########
airflow/providers/common/sql/hooks/sql.py:
##########
@@ -232,22 +270,19 @@ def run(self, sql, autocommit=False, parameters=None,
handler=None):
results = []
for sql_statement in sql:
self._run_command(cur, sql_statement, parameters)
+
if handler is not None:
result = handler(cur)
results.append(result)
- # If autocommit was set to False for db that supports autocommit,
- # or if db does not supports autocommit, we do a manual commit.
+ # If autocommit was set to False or db does not support
autocommit, we do a manual commit.
if not self.get_autocommit(conn):
conn.commit()
if handler is None:
return None
-
- if scalar:
- return results[0]
-
- return results
+ else:
Review Comment:
hmm. I see that there are different behaviours in different operators. I
think for now maybe we need another parameter (scalar_single_result: bool) ?
this way we could keep full backwards compatibility in all the providers I
think ?
--
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]