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

Always Rollback When Closing/Returning a Connection and Support Connection Subclassing #26

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dongyx
Copy link

@dongyx dongyx commented Feb 3, 2024

  1. While closing a connection, even it's just returned to the pool, rollback() should be called to keep consistent with the behavior of real closing and to prevent from chaos between multiple sessions;

  2. Support subclassing pymysql.Connection.

…ction Subclassing

1. While closing a connection, even it's just returned to the pool, `rollback()` should be called to keep consistent with the behavior of real closing and to prevent from chaos between multiple sessions;
2. Support subclassing `pymysql.Connection`.
@jkklee
Copy link
Owner

jkklee commented Feb 5, 2024

tks @dongyx

  1. The intention of this library is to be completely consistent with pymysql, except for the additional logic to maintain the connection pool, and Pymysql does not explicitly perform rollback when closing connections. So I don't think there's much need to add this feature. The manipulation of transactions is up to the developer to care about; after all, explicit is better than implicit.

@dongyx
Copy link
Author

dongyx commented Feb 6, 2024 via email

@jkklee
Copy link
Owner

jkklee commented Feb 20, 2024

Note that closing a connection without committing the changes first will cause an implicit rollback to be performed.

As far as I know, this is the action of MySQL,and does not need to handle this at the library software level。

On the other hand, PyMySQL's code does not have an active rollback operation.

@dongyx
Copy link
Author

dongyx commented Feb 22, 2024 via email

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.

None yet

2 participants