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
{{ message }}
Repository navigation
ReadOptions support for 'Connection.lookup', 'Connection.run_query' #305
The protobuf specs for the lookup RPC and the runQuery RPC show an optional 'read_options' field, which denominate the consistency level and optional transaction to be used. Do we need to support this field?
// The read consistency to use.
// Cannot be set when transaction is set.
// Lookup and ancestor queries default to STRONG, global queries default to
// EVENTUAL and cannot be set to STRONG.
If transaction was passed, we would copy it onto the ReadOpttions.transaction field.
Otherwise, if read_consistency were not-none (one of "STRONG" or "EVENTUAL"), we would set the corresponding enum value onto the ReadOptions.read_consistency field. We would not try to pre-enforce the semantics described in the protobuf spec.
We would need to update Query.fetch to allow passing transaction and read_consistency through to Connection.run_query.
In Connection.lookup and Connection.run_query, should the default value for transaction be the value of the Connection's object transaction, so that if we are already inside a transaction, it's automatically applied ?
In Dataset.get_entities and Query.fetch, should we raise an error if a transaction and eventual=True are passed, or silently ignore it and favor one of the two options?
IRT the first question, that sounds sensible to me (and most like what a user would expect).
For the second, we might need to rely on having the Connection methods raise an exception (since the allowed values would depend on whether a transaction was active).
I think maybe we leave transaction out of the signature of Connection.lookup and Query.fetch: if the connection already has a transaction, then we just use it (and raise an error if eventual is passed). Otherwise, if eventual is passed we set the flag on the request.
I don't know if we should be trying to pre-enforce that STRONG is incompatible with queries that are not ancestor-based. I'm assuming that the back-end returns an error if the QueryRequest protobuf contains it with a non-ancestor filter.
Activity
tseaver commentedon Oct 28, 2014
FWIW, the protobuf spec for the ReadOptions message says:
Connection.lookup()would thus resemble:transactionwas passed, we would copy it onto theReadOpttions.transactionfield.eventualwere True, we would set the enum value onto theReadOptions.read_consistencyfield.We would need to update
Dataset.get_entitiesto allow passingtransactionandeventualthrough toConnection.lookup.Likewise,
Connection.run_querywould resemble:transactionwas passed, we would copy it onto theReadOpttions.transactionfield.read_consistencywere not-none (one of "STRONG" or "EVENTUAL"), we would set the corresponding enum value onto theReadOptions.read_consistencyfield. We would not try to pre-enforce the semantics described in the protobuf spec.We would need to update
Query.fetchto allow passingtransactionandread_consistencythrough toConnection.run_query.silvolu commentedon Oct 28, 2014
Sounds good to me. 2 questions:
Connection.lookupandConnection.run_query, should the default value for transaction be the value of the Connection's object transaction, so that if we are already inside a transaction, it's automatically applied ?Dataset.get_entitiesandQuery.fetch, should we raise an error if a transaction and eventual=True are passed, or silently ignore it and favor one of the two options?tseaver commentedon Oct 28, 2014
IRT the first question, that sounds sensible to me (and most like what a user would expect).
For the second, we might need to rely on having the Connection methods raise an exception (since the allowed values would depend on whether a transaction was active).
silvolu commentedon Oct 28, 2014
Cool, SGTM.
tseaver commentedon Dec 17, 2014
I think maybe we leave
transactionout of the signature ofConnection.lookupandQuery.fetch: if the connection already has a transaction, then we just use it (and raise an error ifeventualis passed). Otherwise, ifeventualis passed we set the flag on the request.I don't know if we should be trying to pre-enforce that
STRONGis incompatible with queries that are not ancestor-based. I'm assuming that the back-end returns an error if the QueryRequest protobuf contains it with a non-ancestor filter.chore(deps): update dependency google-cloud-storage to v2 (#305)
chore(deps): update dependency google-cloud-storage to v2 (#305)
32 remaining items
docs: add paramter mutation_timeout to instance.table docs (#305)
chore(main): release 0.35.0 (#305)
feat: Adding support to specify browser while launching browser to au…
chore(main): release 1.20.3 (#305)
chore(python): use ubuntu 22.04 in docs image (#305)
test: use python 3.10 for docs (#305)
chore(deps): update all dependencies (#305)
chore: docs, tests, and formatting updates via generator (#305)
fix: Fix bug with the _GlobalCacheGetBatch. (#305)
Release v1.6.1 (#305)
chore(deps): update github artifact actions (major) (#305)
chore: fix kokoro and mypy presubmits (#305)
dbapi: implement 2 different Connection+Cursor combinations
tests: bump max retries for 429/503 (#305)
chore: fix kokoro and mypy presubmits (#305)