Sequel::Model definition raises a transaction unsupported error
ZimbiX opened this issue · 0 comments
ZimbiX commented
Raised in an email from Leonardo Falcao (@lfalcao?) - thanks!
I had no idea that there was an issue with Sequel::Model
, as I don't use it; personally preferring to use dry-struct and the repository pattern. I would have expected it to work, having partially implemented schema fetching in #schema_parse_table
.
Defining a Sequel model calls #transaction
internally, which seemed to be bypassing the transaction buffering; so Sequel::Model(db[:book])
is understandably failing with:
Sequel::DatabaseError: Google::Cloud::InvalidArgumentError: Transaction control statements are supported only in scripts or sessions
from /home/brendan/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/google-cloud-bigquery-1.38.1/lib/google/cloud/bigquery/dataset.rb:2777:in `rescue in ensure_job_succeeded!'
I have a WIP that makes definition work by using a session (related: #11), which I'll push shortly.