Re: [I] sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres when adding connection via UI [airflow]
potiuk closed issue #55223: sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres when adding connection via UI URL: https://github.com/apache/airflow/issues/55223 -- 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]
Re: [I] sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres when adding connection via UI [airflow]
potiuk commented on issue #55223: URL: https://github.com/apache/airflow/issues/55223#issuecomment-3251263116 See the note here: https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#generating-a-connection-uri > The get_uri() method return the connection URI in Airflow format, not a SQLAlchemy-compatible URI. if you need a SQLAlchemy-compatible URI for database connections, use [sqlalchemy_url](https://airflow.apache.org/docs/apache-airflow-providers-common-sql/stable/_api/airflow/providers/common/sql/hooks/sql/index.html#airflow.providers.common.sql.hooks.sql.DbApiHook.sqlalchemy_url) property instead. If you find any place where it is mentioned that getUri returns SQLAlchemy URI - can you please submit a PR correcting that and copying information above? -- 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]
[I] sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres when adding connection via UI [airflow]
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
https://github.com/user-attachments/assets/6a3dc62a-a7fb-4e12-b744-31e42fb556b4";
/>
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 "", 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]
Re: [I] sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres when adding connection via UI [airflow]
boring-cyborg[bot] commented on issue #55223: URL: https://github.com/apache/airflow/issues/55223#issuecomment-3249959476 Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval. -- 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]
