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


##########
airflow/providers/snowflake/hooks/snowflake.py:
##########
@@ -305,15 +306,22 @@ def run(
             before executing the query.
         :param parameters: The parameters to render the SQL query with.
         :param handler: The result handler which is called with the result of 
each statement.
+        :param split_statements: Whether to split a single SQL string into 
statements and run separately
+        :param return_last: Whether to return result for only last statement 
or for all after split
+        :return: return only result of the LAST SQL expression if handler was 
provided.
         """
         self.query_ids = []
 
+        scalar_return_last = isinstance(sql, str) and return_last
         if isinstance(sql, str):
-            split_statements_tuple = split_statements(StringIO(sql))
-            sql = [sql_string for sql_string, _ in split_statements_tuple if 
sql_string]
+            if split_statements:
+                split_statements_tuple = 
util_text.split_statements(StringIO(sql))
+                sql = [sql_string for sql_string, _ in split_statements_tuple 
if sql_string]
+            else:
+                sql = [sql]

Review Comment:
   Correct. I missed it -ideally yes all the "split statement" code should be 
in the DBHool (now in common.sql). And we could even add >= 1.1  in case we add 
some features to common.sql . In case there are no breaking changes, this is 
perfectly fine to add >= 1.Y to any of the providers.



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