Skip to content

Commit 15d626a

Browse files
jlara310parthea
andauthored
samples: Update the read_time snippet. (#363)
Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 894015d commit 15d626a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • packages/google-cloud-datastore/samples/snippets

packages/google-cloud-datastore/samples/snippets/snippets.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ def not_in_query(client):
5858

5959

6060
def query_with_readtime(client):
61-
# [START datastore_snapshot_read]
62-
# Create a read time of 120 seconds in the past
63-
read_time = datetime.now(timezone.utc) - timedelta(seconds=120)
61+
# [START datastore_stale_read]
62+
# Create a read time of 15 seconds in the past
63+
read_time = datetime.now(timezone.utc) - timedelta(seconds=15)
6464

65-
# Fetch an entity at time read_time
65+
# Fetch an entity with read_time
6666
task_key = client.key('Task', 'sampletask')
6767
entity = client.get(task_key, read_time=read_time)
6868

69-
# Query Task entities at time read_time
69+
# Query Task entities with read_time
7070
query = client.query(kind="Task")
7171
tasks = query.fetch(read_time=read_time, limit=10)
72-
# [END datastore_snapshot_read]
72+
# [END datastore_stale_read]
7373

7474
results = list(tasks)
7575
results.append(entity)

0 commit comments

Comments
 (0)