Bee2A opened a new issue, #55223:
URL: https://github.com/apache/airflow/issues/55223

   ### Apache Airflow Provider(s)
   
   postgres
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-postgres==6.2.0
   
   ### Apache Airflow version
   
   2.11.0
   
   ### Operating System
   
   Debian
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   FROM apache/airflow:2.11.0-python3.12
   
   ### What happened
   
   1. Adding a new Posgtres-Connection via the UI and chosing "Postgres" as the 
Connection Type
   
   <img width="1118" height="212" alt="Image" 
src="https://github.com/user-attachments/assets/6a3dc62a-a7fb-4e12-b744-31e42fb556b4";
 />
   
   
   <img width="783" height="54" alt="Image" 
src="https://github.com/user-attachments/assets/5ec59ee3-f3ec-4f35-aa6f-0d27fa2031eb";
 />
   
   
   2. Retrieving the URI for this connection in a Task with: `uri 
=Connection.get_connection_from_secrets('Test-Postgres').get_uri()` results in: 
`'postgres://my_user:my_pw@my_host:5432/my_db'`
   3. Using the generated URI ends up in the following exception, because it 
starts with '`postgres://`'  and thus is not supported by SQLAlchemy 1.4+
   4. Exception:
   File "<string>", line 2, in create_engine
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/util/deprecations.py",
 line 375, in warned
       return fn(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/create.py",
 line 518, in create_engine
       entrypoint = u._get_entrypoint()
                    ^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/url.py", 
line 662, in _get_entrypoint
       cls = registry.load(name)
             ^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py",
 line 343, in load
       raise exc.NoSuchModuleError(
   sqlalchemy.exc.NoSuchModuleError: Can't load plugin: 
sqlalchemy.dialects:postgres
   
   
   ### What you think should happen instead
   
   A URI for a Postgres-connection added via the UI should either result in:
   `'postgresql://my_user:my_pw@my_host:5432/my_db'`
   
   or
   
   `'postgresql+psycopg2://my_user:my_pw@my_host:5432/my_db'`
   
   ### How to reproduce
   
   Add a Postgres-Connection via UI and use the retrieved uri for a 
db-connection
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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