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

Connection Pool Implementation #20

Closed
wants to merge 1 commit into from
Closed

Conversation

asanger
Copy link
Contributor

@asanger asanger commented Nov 27, 2024

@tjni
Copy link
Owner

tjni commented Nov 27, 2024

I'm aligned with this in broad strokes. The one area I'd consider modifying is to by default still not use the pool to keep it the same as upstream's PostgresSQL implementation.

Correct me if I'm wrong, but I think upstream expects that creation of a pool is done outside of the from_conn_string convenience method. But I'm open to adding extra arguments to from_conn_string to make this more convenient: a boolean to decide whether to use a pool or not, and maybe room for extra arguments (such as size, pool recycle, etc.).

What do you think?

@tjni
Copy link
Owner

tjni commented Nov 27, 2024

Alternatively, we can expose the query parsing logic as a static method for ease of use in constructing the pool separately. I don't have a strong opinion either way.

@asanger
Copy link
Contributor Author

asanger commented Nov 28, 2024

Honestly, I'm having a hard time groking how the Postgres version is handling pools. I think the Postgres lib allows you to create an AsyncConnection that can contain Pool properties, but with MySQL I think you have to use either a Conn or a Pool which are similar but a pool can't be used directly as a connection.

I think what we ultimately want is as close to a 1:1 of the Postgres implementation as possible because as they make changes it'll make things easier to update. But I know that due to the differences between dependencies, that won't always be possible.

Also, python is definitely not my primary language so I don't have a deep understanding of how MySQL/aiomysql/etc work with py. I'm just trying to figure it all out as I go :)

You are more than welcome to take what I have in my PR and make adjustments as needed, I just need the ability to use connection pools.

@tjni
Copy link
Owner

tjni commented Dec 5, 2024

I apologize for taking so long on this. This week is busy for me at work, and I realized I need more focused time and brain power to understand how to incorporate those latest changes. (Specifically, I think I want to port those pregel tests over to test the race condition, so I can figure out how or if we need to duplicate the transaction logic.)

I expect to have time this Saturday to dig into this and hopefully get something working based on upstream to unblock you.

@tjni
Copy link
Owner

tjni commented Jan 3, 2025

I think this has been addressed now, so optimistically closing this PR. Thank you for your help with this!

@tjni tjni closed this Jan 3, 2025
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