eladkal commented on a change in pull request #22333:
URL: https://github.com/apache/airflow/pull/22333#discussion_r829106399



##########
File path: airflow/settings.py
##########
@@ -228,6 +229,19 @@ def configure_vars():
     global PLUGINS_FOLDER
     global DONOT_MODIFY_HANDLERS
     SQL_ALCHEMY_CONN = conf.get('core', 'SQL_ALCHEMY_CONN')
+
+    # as of sqlalchemy 1.4, scheme `postgres+psycopg2` must be replaced with 
`postgresql`
+    parsed = urlparse(SQL_ALCHEMY_CONN)
+    bad_scheme = 'postgres+psycopg2'
+    if parsed.scheme == bad_scheme:
+        warnings.warn(
+            f"Scheme for metadata sql alchemy connection is `{bad_scheme}`."
+            "As of sqlalchemy 1.4 this is no longer supported.  You must 
change "
+            "to `postgresql`",
+            PendingDeprecationWarning,

Review comment:
       We probably should.
   
   By the way sqlalchemy does something really nice where it makes it's own 
deprecation warnning with specific class
   
https://github.com/sqlalchemy/sqlalchemy/blob/769fa67d842035dd852ab8b6a26ea3f110a51131/lib/sqlalchemy/exc.py#L779
   
   for example:
   `[2022-03-17 09:02:03,734] {logging_mixin.py:115} WARNING - 
/opt/***/***/models/dag.py:1084 SADeprecationWarning: Query.value() is 
deprecated and will be removed in a future release.  Please use 
Query.with_entities() in combination with Query.scalar() (deprecated since: 
1.4)`
   
   It's very nice to know what package originated the warning.
   
   




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