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

Commit d39e422

Browse files
committed
Resolved comments
1 parent 291d3ea commit d39e422

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

samples/snippets/increment.py

Whitespace-only changes.

samples/snippets/writes/write_increment_async.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ async def write_increment_async(project_id, instance_id, table_id):
77
"""Increments a value in a Bigtable table using the async client."""
88
async with BigtableDataClientAsync(project=project_id) as client:
99
table = client.get_table(instance_id, table_id)
10-
row_key = "unique_device_ids_1"
10+
# Define the row key as a byte string
11+
row_key = b"unique_device_ids_1"
1112
try:
1213
async with table.mutations_batcher() as batcher:
1314
# The AddToCell mutation increments the value of a cell.
@@ -17,10 +18,10 @@ async def write_increment_async(project_id, instance_id, table_id):
1718
qualifier="odometer",
1819
value=32304
1920
)
20-
await batcher.append(RowMutationEntry(row_key.encode("utf-8"), [reading]))
21+
await batcher.append(RowMutationEntry(row_key, [reading]))
22+
print(f"Successfully incremented row {row_key.decode('utf-8')}.")
2123
except MutationsExceptionGroup as e:
22-
# MutationsExceptionGroup contains a FailedMutationEntryError for
23-
# each mutation that failed.
24+
print(f"Failed to increment row {row_key.decode('utf-8')}")
2425
for sub_exception in e.exceptions:
2526
failed_entry: RowMutationEntry = sub_exception.entry
2627
cause: Exception = sub_exception.__cause__

samples/snippets/writes/writes_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@ def _write_increment_async():
8080

8181
_write_increment_async()
8282
out, _ = capsys.readouterr()
83-
assert "Successfully incremented row" in out
83+
assert "Successfully incremented row" in out

samples/writes/increment.py

Whitespace-only changes.

0 commit comments

Comments
 (0)