RehanAhmad25 commented on code in PR #74539:
URL: https://github.com/apache/airflow/pull/74539#discussion_r4308123510
##########
providers/microsoft/mssql/src/airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -80,12 +134,12 @@ def get_uri(self) -> str:
from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit
r = list(urlsplit(super().get_uri()))
- # change pymssql driver:
+ # change the sqlalchemy driver:
r[0] = self.sqlalchemy_scheme
- # remove query string 'sqlalchemy_scheme' like parameters:
+ # remove query string parameters that are meant for the hook, not for
the sqlalchemy dialect:
qs = parse_qs(r[3], keep_blank_values=True)
for k in list(qs.keys()):
- if k.lower() == "sqlalchemy_scheme":
+ if k.lower() in self._AIRFLOW_ONLY_EXTRAS:
Review Comment:
Good catch, I reproduced it. With SQLAlchemy 2.1.5 the mssqlpython dialect
puts every query key into the connection string, and mssql-python 1.15.0 raises
ConnectionStringParseError: Unknown keyword 'placeholder'. get_uri() now drops
the same hook-only extras as get_conn() when the driver is mssql_python, and I
fixed the comment on the constants. Added a test that sets placeholder and
escape_word_format and checks they are not in the URI.
--
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]