potiuk commented on a change in pull request #17329:
URL: https://github.com/apache/airflow/pull/17329#discussion_r716130509
##########
File path: airflow/hooks/dbapi.py
##########
@@ -259,6 +266,27 @@ def get_cursor(self):
"""Returns a cursor"""
return self.get_conn().cursor()
+ @staticmethod
+ def _split_sql_statements(sql, strip_comments=True, strip_semicolon=True,
**kwargs):
+ """
+ Split multiple sql statements in string
+
+ :param sql: sql statements.
+ :type sql: str or list.
+ :return: splitted sql statements.
+ :rtype: list.
+ """
+ if isinstance(sql, str):
+ sql = [sql]
+
+ return [
+ s.rstrip(';') if strip_semicolon else s
Review comment:
I believe there are certain engines, that actually will complain if `;`
is passed. MsSQL particularly I believe.
I just learn couple of days that when you use CLI (via ODBC) to MsSQL, `;`
at the end of SQL query does not make it execute - it will complain. Instead
wheat you need to do is to type `GO` in the next line 😱
--
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]