RehanAhmad25 commented on code in PR #74539:
URL: https://github.com/apache/airflow/pull/74539#discussion_r4625467942


##########
providers/microsoft/mssql/src/airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -81,12 +135,17 @@ 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:
+        hook_only_extras = (

Review Comment:
   Fixed. For mssql_python the hook now builds `sqlalchemy_url` with 
`URL.create(...)` from the connection fields and the extras (stringified), 
dropping the hook-only and empty ones. `get_uri()` renders that URL, so bool 
extras like TrustServerCertificate no longer end up in `__extra__`. I added 
tests for the bool case and for the URL itself. Unknown keys such as a leftover 
`timeout` are still rejected when the URL goes through the SQLAlchemy dialect, 
while `get_conn()` only warns. Matching that leniency would mean using 
mssql-python's private key normalizer, so I kept it strict and added a docs 
note to remove pymssql-only options. Can change it if you prefer.



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