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
feat: autocommit sample #552
Conversation
Here is the summary of changes. You added 1 region tag.This comment is generated by snippet-bot. |
@c24t could you take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments, but the sample looks good and the test works after making a small change.
I see this sample describes how to enable autocommit, but doesn't show the difference between auto and non-auto behavior. Ideally this sample would show multiple queries each getting a separate txn in autocommit mode and getting combined in a single txn in non-auto mode. And would show manual commit
calls.
Not a problem with this sample, but a problem with the library: we should respect django's autocommit setting. When DBAPI is moved out of this library I wouldn't expect users to set connection.autocommit
themselves.
…n-spanner-django into autocommit_samples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your detailed review!
I see this sample describes how to enable autocommit, but doesn't show the difference between auto and non-auto behavior. Ideally this sample would show multiple queries each getting a separate txn in autocommit mode and getting combined in a single txn in non-auto mode. And would show manual
commit
calls.
I'm sorry, I wasn't correct in a comment and the sample doesn't show the difference between those two modes. I wanted to say that it shows only one of the modes. And for other mode there will be another sample. So users will see that way the difference themselves.
Not a problem with this sample, but a problem with the library: we should respect django's autocommit setting. When DBAPI is moved out of this library I wouldn't expect users to set
connection.autocommit
themselves.
Just to clarify: I need to use set_autocommit
function instead?
That sounds fine, let's see how these samples appear in the cloud docs.
Ideally yes, this would just follow django's autocommit setting and the user wouldn't set this at all. But now since googleapis/python-spanner#160 moved the DBAPI package into python-spanner we might need to move these samples over too, and write different django-specific docs for this spanner-django. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but let's check whether this should move into python-spanner with googleapis/python-spanner#160 before merging here.
snippet-bot thinks it's violating a region tag rule where we should have product prefix. If you change the region tag to |
Thank you! Bot is happy now 🎉 |
The "Create Database" part of the test suite is failing b/c the database already exists. From the logs:
Looks like it's a pre-existing issue unrelated to this PR here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the tests are passing, I only have formatting nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your help!
@AlisskaPie can we close this in favor of googleapis/python-spanner#172? |
Yes, sure! Sorry I forgot about it. |
This is one of the samples that demonstrates the difference between autocommit and !autocommit modes