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

tembo_pgmq_python: Add python async interface #305

Merged
merged 6 commits into from
Sep 10, 2024

Conversation

szobov
Copy link
Contributor

@szobov szobov commented Sep 3, 2024

Hey there,

First, thanks for your work on making PostgreSQL even more powerful!

I wanted to adapt PGMQ, but the lack of a modern async Python interface was a showstopper.
This PR brings such implementation to help the adoption of PGMQ for Python's users.

A few notes on implementation:

  1. The database driver is asyncpg. Its most widely used async driver was also adopted by SQLAlchemy.
  2. Unfortunately, Python's async and sync functions have different interfaces by definition. Therefore, I can't provide an abstract interface that both sync and async versions will implement.
  3. Also, there is no async version of __post_init__ or __init__. Therefore, I added an explicit init method for the async version. This is the only difference in the interface.
  4. I adopted tests for the async version but didn't adopt benches for it. If it's required, I can do it.

I'm looking forward to your comments.
Thanks!

@ChuckHend ChuckHend merged commit 18465f5 into tembo-io:main Sep 10, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants