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 for psycopg3 #2473

Closed
elderlabs opened this issue Oct 14, 2021 · 12 comments
Closed

Support for psycopg3 #2473

elderlabs opened this issue Oct 14, 2021 · 12 comments

Comments

@elderlabs
Copy link

Preemptive ticket here. The maintainer of psycopg2 has busied themself with its next iteration, psycopg3. Are there plans to add support for the project; is there already native support by design? This ticket's more to see if the project's on your radar as it has officially released, and support for psycopg2 might be in decline fairly soon.

Thanks.

@coleifer
Copy link
Owner

There are a number of psycopg3 changes that look to be backwards-incompatible (which is understandable) but will likely be a pain to identify and work around. Parameter binding, especially, looks like it has changed quite a bit.

It's definitely on my radar and will be added to Peewee, but I will probably wait a bit to add support. If anyone is interested in the meantime, feel free to implement this in a standalone/extension module.

@MaartenUreel
Copy link

Hello

I looked at your extension but I wondering, can I use this in conjuction with PostgresqlExtDatabase?

Any plans on built-in support for psycopg3? Considering is also adding it in their next release and it is a stable release..

@coleifer
Copy link
Owner

Are there any specific features of PostgresqlExtDatabase you were intending to use - e.g. jsonb, arrays? I'll have to spend some time seeing what works and what doesn't, since we use some helpers from psycopg2.extras (e.g. Json).

@MaartenUreel
Copy link

I'm going through all my raw SQL code currently, but if I'm not mistaken I will have some jsonb-specifics.

I will use psycopg2 for now though, but it would be great to see support for 3.

@coleifer
Copy link
Owner

No, I agree with you, things are going to be moving towards psycopg3 in the coming years so I'll want to be ready for that. Thanks for the ping on this, I'll be aiming to getting parity for psycopg3 with the current PostgresqlExtDatabase. No definitive timeline but it's a priority for me.

@amirreza8002
Copy link

hello
so i'm wondering if there are any news on this?

@coleifer
Copy link
Owner

coleifer commented Apr 9, 2024

Merged into master.

@HammerMeetNail
Copy link

@coleifer Great to see this merged. When do you think a release will be cut?

@andrewchen5678
Copy link

it is not merged to master yet, I just checked master and it is still have the hard coded check for psycopg2 for postgres, which is not the right package for psycopg3. The right package for psycopg3 is psycopg without 2. Please reopen this ticket.

    def _connect(self):
        if psycopg2 is None:
            raise ImproperlyConfigured('Postgres driver not installed!')

@coleifer
Copy link
Owner

The standard PostgresqlDatabase will continue to use psycopg2 for the foreseeable future. To use psycopg3, use playhouse.psycopg3_ext.Psycopg3Database.

@harishvadali
Copy link

@coleifer Thank you for adding the psycopg3 support. I see the field for BinaryJSONField but not JSONField with psycopg3. Is that on roadmap?

@coleifer
Copy link
Owner

Is there a compelling reason not to use jsonb?

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

7 participants