我看到 Google Cloud 的示例代码中有 2 个 hbase 表扫描 API:
1)使用 google.cloud 模块 bigtable 对象 https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/bigtable/hello/main.py
from google.cloud import bigtable
client = bigtable.Client(project=project_id, admin=True)
instance = client.instance(instance_id)
table = instance.table(table_id)
partial_rows = table.read_rows(...)
partial_rows.consume_all()
for row_key, row in partial_rows.rows.items():
2) 使用 google.cloud 模块 bigtable 和 happybase 对象 https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/bigtable/hello_happybase/main.py
from google.cloud import bigtable
from google.cloud import happybase
client = bigtable.Client(project=project_id, admin=True)
instance = client.instance(instance_id)
connection = happybase.Connection(instance=instance)
table = connection.table(table_name)
for key, row in table.scan():
这两种机制中的哪一种是扫描 BigTable 的推荐方法?
此外,它们是否适合从 PySpark 使用?