【发布时间】:2019-08-30 15:49:27
【问题描述】:
我想使用 python 在 Apache Beam 管道中获取由 Google Datastore 自动生成的 Google Datastore 的实体 ID(我不能使用 uuid)。
在 Datastore 中构建实体时,我使用以下代码传递实体种类和键值。
from googledatastore import helper as datastore_helper
entity = entity_pb2.Entity()
datastore_helper.add_key_path(entity.key, entityName.get(), str(uuid.uuid4()))
在上面的代码中,我不能使用uuid.uuid4()根据项目要求随机生成唯一ID。我必须使用 Google Datastore 的自动 ID 生成。经过大量阅读,我仍然不确定将什么传递给数据存储助手以使其在不使用 uuid 的情况下处理唯一 id 生成。请帮忙。
【问题讨论】:
标签: python google-cloud-datastore google-cloud-dataflow apache-beam