pankajkoti commented on code in PR #31984:
URL: https://github.com/apache/airflow/pull/31984#discussion_r1233313245
##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -63,11 +63,10 @@ def connection_extra_lower(self) -> dict:
@property
def sqlalchemy_scheme(self) -> str:
"""Sqlalchemy scheme either from constructor, connection extras or
default."""
- return (
- self._sqlalchemy_scheme
- or self.connection_extra_lower.get("sqlalchemy_scheme")
- or self.DEFAULT_SQLALCHEMY_SCHEME
- )
+ extra_scheme = self.connection_extra_lower.get("sqlalchemy_scheme")
+ if not self._sqlalchemy_scheme and extra_scheme and (":" in
extra_scheme or "/" in extra_scheme):
+ raise RuntimeError("sqlalchemy_scheme in connection extra should
not contain : or / characters")
+ return self._sqlalchemy_scheme or extra_scheme or
self.DEFAULT_SQLALCHEMY_SCHEME
Review Comment:
yes, not sure, how users use it. I saw it in a few other places where extras
take precedence over constructor/hook params and hence was curious to
understand. Changing the hook/constructor params would need DAG/code changes
and the need to update that, whereas changing the extras would not need code
changes and more or less like changing an environment variable.
No strong opinion, just wanted to understand :)
--
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]