hussein-awala commented on code in PR #31984: URL: https://github.com/apache/airflow/pull/31984#discussion_r1233310952
########## 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: > If the user has set sqlalchemy_scheme via constructor but wants to override via extras, will we not allow it? why does he need to override a very flexible value provided to the constructor by an extra provided in very less flexible way (connection). If he wants to use the connection scheme he can skip providing a value to the constructor, and if he want to override the connection scheme, he can provide the new value to the constructor. We can easily create 10 instances of this hook, but we can easily create and manage 10 different connection. So for me it's perfect like that: constructor/hook params > connection extras > default -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org