fritz-astronomer opened a new issue, #25317:
URL: https://github.com/apache/airflow/issues/25317

   ### Apache Airflow version
   
   2.3.3 (latest released)
   
   ### What happened
   
   Airflow is inconsistent regarding it's treatment of `postgres` vs 
`postgresql`
   `postgresql` is correct for a URI, however `postgres` is also fine for a 
"Conn Type".
   
   This at the very least causes confusion, if not errors, depending on how a 
connection is accessed (correct via `PostgresHook`, incorrect via `BaseHook`). 
   It is also confusing as Airflow maybe be changing the connection URI 
supplied, without any notice/reason/explanation
   
   
https://github.com/apache/airflow/blob/main/airflow/models/connection.py#L181-L188
   `Connection`
   ```    def __init__( ... ):
           ....
           if uri:
               self._parse_from_uri(uri)
           ....
   
       @staticmethod
       def _normalize_conn_type(conn_type):
           if conn_type == 'postgresql':
               conn_type = 'postgres'
           ....
   
       def _parse_from_uri(self, uri: str):
           ....
           self.conn_type = self._normalize_conn_type(conn_type)
   ```
   
   
https://github.com/apache/airflow/blob/main/airflow/providers/postgres/hooks/postgres.py#L139-L144
   `PostgresHook.get_uri`
   ```    def get_uri(self) -> str:
           uri = super().get_uri().replace("postgres://", "postgresql://")
   ```
   
   
https://github.com/apache/airflow/blob/main/airflow/providers/postgres/hooks/postgres.py#L63-L64
   ```
       conn_type = 'postgres'
       hook_name = 'Postgres'
   ```
   
   SQLAlchemy wants `postgresql`
   ```>>> print(dialects.__all__)
   ('firebird', 'mssql', 'mysql', 'oracle', 'postgresql', 'sqlite', 'sybase')
   >>> print(sqlalchemy.__version__)
   1.4.9
   ```
   
   
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   _No response_
   
   ### Operating System
   
   Any
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   _No response_
   
   ### 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