Add proper transaction support by using a BigQuery session #13
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::Model
support.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_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:
#transaction
works now, but manually runningbegin
probably doesn't, since it lacks the; select 1
workaround: googleapis/google-cloud-ruby#9617 (comment).Todo:
begin