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

fix: don't reset attributes of non-Spanner connections #222

Merged
merged 2 commits into from
Jun 20, 2022

Conversation

IlyaFaer
Copy link
Contributor

@IlyaFaer IlyaFaer commented Jun 17, 2022

Fixes #221

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API. label Jun 17, 2022
@IlyaFaer
Copy link
Contributor Author

The errors failing in this PR will be fixed with the PR:
googleapis/python-spanner#750

@IlyaFaer IlyaFaer marked this pull request as ready for review June 20, 2022 06:53
@IlyaFaer IlyaFaer added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 20, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 20, 2022
@@ -48,14 +48,14 @@
@listens_for(Pool, "reset")
def reset_connection(dbapi_conn, connection_record):
"""An event of returning a connection back to a pool."""
if dbapi_conn.connection.inside_transaction:
dbapi_conn.connection.rollback()
if isinstance(dbapi_conn.connection, spanner_dbapi.Connection):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resetting attributes only in case it's a Spanner connection. Otherwise doing rollback(), which is the default behavior of the resetting method.

@IlyaFaer IlyaFaer requested a review from asthamohta June 20, 2022 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API.
Projects
None yet
3 participants