Skip to content

Commit

Permalink
docs(samples): add region tags (#788)
Browse files Browse the repository at this point in the history
* docs(samples): add read table snippet

* remove snippet as it already exists
  • Loading branch information
Sita04 committed May 25, 2023
1 parent ae477b5 commit ecf539c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion samples/hello/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,30 @@ def main(project_id, instance_id, table_id):

# [START bigtable_hw_create_filter]
# Create a filter to only retrieve the most recent version of the cell
# for each column accross entire row.
# for each column across entire row.
row_filter = row_filters.CellsColumnLimitFilter(1)
# [END bigtable_hw_create_filter]

# [START bigtable_hw_get_with_filter]
# [START bigtable_hw_get_by_key]
print("Getting a single greeting by row key.")
key = "greeting0".encode()

row = table.read_row(key, row_filter)
cell = row.cells[column_family_id][column][0]
print(cell.value.decode("utf-8"))
# [END bigtable_hw_get_by_key]
# [END bigtable_hw_get_with_filter]

# [START bigtable_hw_scan_with_filter]
# [START bigtable_hw_scan_all]
print("Scanning for all greetings:")
partial_rows = table.read_rows(filter_=row_filter)

for row in partial_rows:
cell = row.cells[column_family_id][column][0]
print(cell.value.decode("utf-8"))
# [END bigtable_hw_scan_all]
# [END bigtable_hw_scan_with_filter]

# [START bigtable_hw_delete_table]
Expand Down

0 comments on commit ecf539c

Please sign in to comment.