2
votes

I have a Cloud Bigtable table with two column families: small and large. I'd like to scan all rows and access the value in the small column:

client = bigtable.Client(project=project_id, admin=False)
instance = client.instance(instance_id)
table = instance.table(table_id)

for row in table.yield_rows():
    key = row.row_key.decode('utf-8')
    small_value = row.cells[small_cf][b''][0].value
    print(key, small_value)

This works, but will also fetch the value of the large CF which I don't care about. How do I only fetch the data from a particular set of CFs?

1

1 Answers

3
votes

You can use a FamilyNameRegexFilter for this, e.g.:

for row in table.yield_rows(filter_=FamilyNameRegexFilter('small')):