Open abachman opened 9 months ago
module Google module Cloud module Spanner class Service
# @param database [String] in the form of a full Spanner identifier like
# "project/.../instance/.../database/..."
def list_sessions(database:, call_options: nil, token: nil, max: nil)
opts = default_options call_options: call_options
request = {
database: database,
page_size: max,
page_token: token
}
paged_enum = service.list_sessions request, opts
paged_enum.response
end
end
end
end end
Feature request: I'd like better access to the Ruby Spanner RPC
list_sessions
method to support Emulator session transaction resetting.Background
Facts:
Annoying, because rebuilding large (100+ table, 300+ index, 1000s of columns) database from scratch can take up to 30 seconds. It'd be much faster to just clear stale open transactions for detached sessions.
Fast forward, I figured out how to do this with the existing library, but it required this monkey patch:
And then some egregious private API calling to:
project/instance/database/session
So, it'd be cool to have
list_sessions
as a first class method on whatever class or classes where it makes sense.