Add proper transaction support by using a BigQuery session#13
Draft
Add proper transaction support by using a BigQuery session#13
Conversation
Contributes to #11 and #12. Currently this uses the one session for every query, but the docs say that prevents concurrency. They also say a session gets deleted after 24 hours, which I think would mean that limiting the use of the single session to transactions would cause still problems for an app with greater uptime than that. I think I need to make it create a new session at the start of each top-level transaction, and stop using the session at the end of it. Sequel::Model: The implementation of `#schema_parse_table` was incomplete, and so was preventing a Sequel model from being defined (it inspects the table schema). However, it seems that the method isn't actually essential (or at least, isn't anymore?). I don't recall what necessitated implementing it, but removing it does let a Sequel model be defined successfully. For better support, this should probably be added back later with a full implementation. Note that saving a Sequel model also does work now, but isn't error-free yet: ``` Sequel::Error: can't express [] as a SQL literal from /home/brendan/Projects/sequel/lib/sequel/dataset/sql.rb:1319:in `literal_other_append' ``` `#transaction` works now, but manually running `begin` probably doesn't, since it lacks the `; select 1` workaround: googleapis/google-cloud-ruby#9617 (comment).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes to #11 and #12.
Replaces transaction query buffering with actual transaction support. And introduces
Sequel::Modelsupport.Currently this uses the one session for every query, but the docs say that prevents concurrency. They also say a session gets deleted after 7 days (or 24 hours of inactivity), which I think would mean that limiting the use of the single session to transactions would cause still problems for an app with greater uptime than that. I think I need to make it create a new session at the start of each top-level transaction, and stop using the session at the end of it.
Sequel::Model:
The implementation of
#schema_parse_tablewas incomplete, and so was preventing a Sequel model from being defined (it inspects the table schema). However, it seems that the method isn't actually essential (or at least, isn't anymore?). I don't recall what necessitated implementing it, but removing it does let a Sequel model be defined successfully. For better support, this should probably be added back later with a full implementation.Note that saving a Sequel model also does work now, but isn't error-free yet:
#transactionworks now, but manually runningbeginprobably doesn't, since it lacks the; select 1workaround: googleapis/google-cloud-ruby#9617 (comment).Todo:
begin