From 2fbd5053ef57fee616702ec28f347b5c37932715 Mon Sep 17 00:00:00 2001 From: Jim Morrison Date: Thu, 27 May 2021 18:09:42 -0700 Subject: [PATCH] Do not set read_consistency for queries. In Cloud Datastore ancestor queries are intended to be strong by default (https://cloud.google.com/datastore/docs/concepts/structuring_for_strong_consistency) . In Cloud Firestore in Datastore mode, all queries should be strongly consistent by default (https://cloud.google.com/datastore/docs/upgrade-to-firestore). --- google/cloud/ndb/_datastore_query.py | 4 +--- tests/unit/test__datastore_query.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/google/cloud/ndb/_datastore_query.py b/google/cloud/ndb/_datastore_query.py index 53c2e7c9..4aae2a9b 100644 --- a/google/cloud/ndb/_datastore_query.py +++ b/google/cloud/ndb/_datastore_query.py @@ -1008,9 +1008,7 @@ def _datastore_run_query(query): partition_id = entity_pb2.PartitionId( project_id=query.project, namespace_id=query.namespace ) - read_options = _datastore_api.get_read_options( - query, default_read_consistency=_datastore_api.EVENTUAL - ) + read_options = _datastore_api.get_read_options(query) request = datastore_pb2.RunQueryRequest( project_id=query.project, partition_id=partition_id, diff --git a/tests/unit/test__datastore_query.py b/tests/unit/test__datastore_query.py index edd0edab..01ebb9ec 100644 --- a/tests/unit/test__datastore_query.py +++ b/tests/unit/test__datastore_query.py @@ -1941,9 +1941,7 @@ def test_it(_datastore_api): _datastore_api.make_call.assert_called_once_with( "RunQuery", request, timeout=None ) - _datastore_api.get_read_options.assert_called_once_with( - query, default_read_consistency=_datastore_api.EVENTUAL - ) + _datastore_api.get_read_options.assert_called_once_with(query) class TestCursor: