From 82e6c5b1a2ec36599f9ce22f5eadd8220a5f29ff Mon Sep 17 00:00:00 2001 From: Juan Lara Date: Fri, 16 Sep 2022 00:11:24 +0000 Subject: [PATCH 1/2] Update the read_time snippet. --- samples/snippets/snippets.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/snippets/snippets.py b/samples/snippets/snippets.py index 7d2130a8..b37020c0 100644 --- a/samples/snippets/snippets.py +++ b/samples/snippets/snippets.py @@ -58,18 +58,18 @@ def not_in_query(client): def query_with_readtime(client): - # [START datastore_snapshot_read] - # Create a read time of 120 seconds in the past - read_time = datetime.now(timezone.utc) - timedelta(seconds=120) + # [START datastore_stale_read] + # Create a read time of 15 seconds in the past + read_time = datetime.now(timezone.utc) - timedelta(seconds=15) - # Fetch an entity at time read_time + # Fetch an entity with read_time task_key = client.key('Task', 'sampletask') entity = client.get(task_key, read_time=read_time) - # Query Task entities at time read_time + # Query Task entities with read_time query = client.query(kind="Task") tasks = query.fetch(read_time=read_time, limit=10) - # [END datastore_snapshot_read] + # [END datastore_stale_read] results = list(tasks) results.append(entity) From b79ac75314d55092e7d7b33a577fc23e6f4bc18e Mon Sep 17 00:00:00 2001 From: Juan Lara Date: Fri, 16 Sep 2022 00:11:24 +0000 Subject: [PATCH 2/2] samples: Update the read_time snippet. --- samples/snippets/snippets.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/snippets/snippets.py b/samples/snippets/snippets.py index 7d2130a8..b37020c0 100644 --- a/samples/snippets/snippets.py +++ b/samples/snippets/snippets.py @@ -58,18 +58,18 @@ def not_in_query(client): def query_with_readtime(client): - # [START datastore_snapshot_read] - # Create a read time of 120 seconds in the past - read_time = datetime.now(timezone.utc) - timedelta(seconds=120) + # [START datastore_stale_read] + # Create a read time of 15 seconds in the past + read_time = datetime.now(timezone.utc) - timedelta(seconds=15) - # Fetch an entity at time read_time + # Fetch an entity with read_time task_key = client.key('Task', 'sampletask') entity = client.get(task_key, read_time=read_time) - # Query Task entities at time read_time + # Query Task entities with read_time query = client.query(kind="Task") tasks = query.fetch(read_time=read_time, limit=10) - # [END datastore_snapshot_read] + # [END datastore_stale_read] results = list(tasks) results.append(entity)