我有一个Cloud Bigtable表,其中包含两个列族:small
和large
。我想扫描所有行并访问small
列中的值:
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)
这可行,但也将获取我不在乎的large
CF的值。如何仅从一组特定的CF中获取数据?
答案 0 :(得分:3)
您可以为此使用FamilyNameRegexFilter
,例如:
for row in table.yield_rows(filter_=FamilyNameRegexFilter('small')):