feat(db_api): add an ability to set ReadOnly/ReadWrite connection mode#475
feat(db_api): add an ability to set ReadOnly/ReadWrite connection mode#475IlyaFaer merged 37 commits intogoogleapis:mainfrom
Conversation
Co-authored-by: Knut Olav Løite <koloite@gmail.com>
…ython-spanner into read_only_transactions
|
@larkee, hm, okay. If we want to use the |
By default, a snapshot is a single-use read-only transaction so it would only be valid for one read operation. However, there is an option make a multi-use snapshot in which all reads are from the same snapshot of data i.e. data is consistent. Multi-use snapshot example: https://cloud.google.com/spanner/docs/transactions#ro_transaction_example With this in mind, I think using |
Yes, that is the intention here. So the implementation should roughly be:
|
|
@skuruppu, of course, it's not. I don't want to sound boring, but I can't see why you both think it's that performance influencing. We don't calculate checksums in Anyway it's pushed. |
Sorry, that was my fault. I didn't realize that you had already created that change, as the comment that you referenced above didn't say anything about that.
In my opinion, the current implementation would have been slightly confusing for a potential new developer. The retry mechanism is not needed for read-only transactions. I think that it is better that it is completely clear in the code to prevent anyone from accidentally re-enabling it in the future. (This last commit for example has also removed an unnecessary test case that tested the retry mechanism for a query in autocommit mode; a situation that could not happen, but still was part of the code base.) Anyways, I'm happy enough with this as-is, but we should add a system test ASAP to actually show that it is working as intended. If @skuruppu and/or @larkee are OK with that, then we could do that in a separate PR. |
|
Ultimately @larkee needs to approve this as the code owner so please do add any tests that they ask for before merging. |
|
@IlyaFaer I second what @olavloite said. The refactor is less about performance (since it should be roughly equivalent) but is more about readability and reducing confusion for new developers. However, if you create a tracking issue for the refactor work, I will approve and merge this PR 👍 |
|
I think all comments are already processed. I've pushed changes with adding I also returned back that deleted-by-merge-of-another-commit system test. It checks that I think it's worth adding a unit test, which'll check that |
|
Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, one of your required reviews was not approved, or there is a do not merge label. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot. |
|
Looking at |
Proposal for the user's question: googleapis/python-spanner-sqlalchemy#97
Will require small changes in SQLAlchemy dialect as well.