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


##########
providers/microsoft/mssql/src/airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -60,13 +83,39 @@ def __init__(
         self.schema = kwargs.pop("schema", None)
         self._sqlalchemy_scheme = sqlalchemy_scheme
 
+    @property
+    def dbapi_driver(self) -> str:
+        """DBAPI driver, either ``pymssql`` (default) or ``mssql_python``, 
from the connection extra."""
+        driver = str(self.connection_extra_lower.get("dbapi_driver") or 
self.DBAPI_DRIVER_PYMSSQL).lower()
+        if driver not in self.SUPPORTED_DBAPI_DRIVERS:
+            raise ValueError(
+                f"Unsupported dbapi_driver {driver!r} in the connection extra. 
"
+                f"Supported values: {', '.join(self.SUPPORTED_DBAPI_DRIVERS)}"
+            )
+        return driver

Review Comment:
   Thanks, much cleaner. One side effect: an empty string now raises instead of 
falling back to pymssql, which matches the new test case.



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