JavierLopezT commented on a change in pull request #11350:
URL: https://github.com/apache/airflow/pull/11350#discussion_r545812706
##########
File path: airflow/providers/snowflake/hooks/snowflake.py
##########
@@ -142,3 +141,18 @@ def set_autocommit(self, conn, autocommit: Any) -> None:
def get_autocommit(self, conn):
return getattr(conn, 'autocommit_mode', False)
+
+ def run(self, sql, autocommit=False, parameters=None):
+ """
+ Snowflake-connector doesn't allow natively the execution of multiple
SQL statements in the same
+ call. So for allowing to pass files or strings with several queries
this method is coded,
+ that relies on run from DBApiHook
+ """
+ if isinstance(sql, str):
+ with closing(self.get_conn()) as conn:
+ if self.supports_autocommit:
+ self.set_autocommit(conn, autocommit)
+
+ conn.execute_string(sql, parameters)
+ else:
+ super().run(sql, autocommit, parameters)
Review comment:
Hi @kaxil . I think I have to test that depending on whether sql is a
list or a string, it calls conn.execute_string or super().run, but I have no
idea how to do that. Could you help me, please? Thank you very much in advance
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]