potiuk commented on issue #25640:
URL: https://github.com/apache/airflow/issues/25640#issuecomment-1212993848
Just looked it up @alexott -> I do not think it is breaking other providers
(@kazanzhy to confirm).
Only Databricks and Snowflake hooks have `split_statements` set to True by
defauilt (because historically they were doing the split). All the others have
`split_statements = False` as default - so the change is not breaking, for
them. It might not work to split some statements from some DBs using the common
method introduced by Dmitro,. The snowflake one actually does not use this new
method - it continues to uses it's own snowflake-internal
"util.split_statements" so it is unaffected. The Databricks one is the only one
with default `split_statements = True` using this common method.
BTW. Loking at the change I think the problem might be when the query
contains ; followed by whitespace and EOL after. The old regexp and .strip()
would remove such "empty" statement where the new one would likely not do it.
This is the method introduced:
```
@staticmethod
def split_sql_string(sql: str) -> List[str]:
"""
Splits string into multiple SQL expressions
:param sql: SQL string potentially consisting of multiple expressions
:return: list of individual expressions
"""
splits = sqlparse.split(sqlparse.format(sql, strip_comments=True))
statements = [s.rstrip(';') for s in splits if s.endswith(';')]
return statements
```
--
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]