You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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).
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; soSequel::Model(db[:book])
is understandably failing with:I have a WIP that makes definition work by using a session (related: #11), which I'll push shortly.
The text was updated successfully, but these errors were encountered: