Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 4509d6e

Browse files
committed
added timestamp_micros
1 parent 3a32da4 commit 4509d6e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

samples/snippets/data_client/data_client_snippets_async.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ async def write_conditional(project_id, instance_id, table_id):
138138

139139
async def write_aggregate(table):
140140
# [START bigtable_async_write_aggregate]
141+
import time
141142
from google.cloud.bigtable.data import BigtableDataClientAsync
142143
from google.cloud.bigtable.data.mutations import AddToCell, RowMutationEntry
143144
from google.cloud.bigtable.data.exceptions import MutationsExceptionGroup
@@ -154,7 +155,10 @@ async def write_aggregate(project_id, instance_id, table_id):
154155
# The `counters` family must be set up to be an aggregate
155156
# family with an int64 input type.
156157
reading = AddToCell(
157-
family="counters", qualifier="odometer", value=32304
158+
family="counters",
159+
qualifier="odometer",
160+
value=32304,
161+
timestamp_micros=time.time_ns() // 1000,
158162
)
159163
await batcher.append(
160164
RowMutationEntry(row_key.encode("utf-8"), [reading])

0 commit comments

Comments
 (0)