我有一个包含两个列族的 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 中获取数据?
最佳答案
您可以使用 FamilyNameRegexFilter
为此,例如:
for row in table.yield_rows(filter_=FamilyNameRegexFilter('small')):
关于python - 如何从 Cloud Bigtable 中仅读取某些列族?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51333700/