flolas commented on a change in pull request #17329:
URL: https://github.com/apache/airflow/pull/17329#discussion_r683045221
##########
File path: airflow/hooks/dbapi.py
##########
@@ -176,18 +178,29 @@ def run(self, sql, autocommit=False, parameters=None,
handler=None):
:param handler: The result handler which is called with the result of
each statement.
:type handler: callable
:return: query results if handler was provided.
+ :param split_statements: If true, split sql statements
+ :type split_statements: bool
"""
scalar = isinstance(sql, str)
if scalar:
sql = [sql]
+ sql_statements = sql
+
+ if split_statements:
+ sql_statements = []
+ for q in sql:
+ sql_statements.append(
+ [s.rstrip(";") for s in sqlparse.split(sqlparse.format(q,
strip_comments=True))]
+ )
Review comment:
Yes! @uranusjr good catch!
--
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]