Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support psycopg3 #26

Open
di opened this issue Feb 13, 2022 · 3 comments
Open

Support psycopg3 #26

di opened this issue Feb 13, 2022 · 3 comments

Comments

@di
Copy link

di commented Feb 13, 2022

This library currently expects psycopg2 to be co-installed, but psycopg3 has since been released, which is currently incompatible:

Dockerfile:

from python

RUN python -m pip install -U pip psycopg sqlalchemy-citext

RUN python -c "import citext"

Result:

$ docker build .
[+] Building 8.3s (6/6) FINISHED
 => [internal] load build definition from Dockerfile                            0.0s
 => => transferring dockerfile: 35B                                             0.0s
 => [internal] load .dockerignore                                               0.0s
 => => transferring context: 2B                                                 0.0s
 => [internal] load metadata for docker.io/library/python:latest                0.0s
 => CACHED [1/3] FROM docker.io/library/python                                  0.0s
 => [2/3] RUN python -m pip install -U pip psycopg sqlalchemy-citext            7.8s
 => ERROR [3/3] RUN python -c "import citext"                                   0.3s
------
 > [3/3] RUN python -c "import citext":
#6 0.317 Traceback (most recent call last):
#6 0.317   File "<string>", line 1, in <module>
#6 0.318   File "/usr/local/lib/python3.9/site-packages/citext/__init__.py", line 3, in <module>
#6 0.319     import psycopg2.extensions
#6 0.320 ModuleNotFoundError: No module named 'psycopg2'
------
executor failed running [/bin/sh -c python -c "import citext"]: exit code: 1
@Patryk-Foryszewski
Copy link

@di I've run into the same issue and I've been struggling for a while to solve it but I can't. How to deal with this?

@gordthompson
Copy link

Native support for CITEXT was added in SQLAlchemy 2.0.7 and bug-fixed in 2.0.19.

https://docs.sqlalchemy.org/en/20/dialects/postgresql.html#sqlalchemy.dialects.postgresql.CITEXT

@Patryk-Foryszewski
Copy link

@gordthompson Thank you, I supposed it to be imported from sqlalchemy as Integer, String, UUID etc.
Turns out to import CITEXT:

from sqlalchemy.dialects.postgresql.types import CITEXT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants