[英]merge - upsert/delete in google cloud datastore
I am working on a POC (to move part of functionality from relational DB to cloud datastore). 我正在研究POC(将部分功能从关系数据库迁移到云数据存储)。 I have few questions: 我有几个问题:
In order to answer your questions: 为了回答您的问题:
There is two ways to delete multiple entities. 有两种删除多个实体的方法。 First, you can use Cloud Dataflow to delete entities in Bulk [ 1 ]. 首先,您可以使用Cloud Dataflow删除Bulk [ 1 ]中的实体。 Second, once keys are retrieved you can make a batch delete operation by passing the keys to Datastore delete function, you have the usage example here [ 2 ]. 其次,一旦检索到密钥,就可以通过将密钥传递给数据存储删除功能来进行批量删除操作,这里有使用示例[ 2 ]。 In order to retrieve the keys you can run keys-only query [ 3 ]. 为了检索密钥,您可以运行仅密钥查询[ 3 ]。
In Datastore an entitiy can have only one parent but can have multiple children. 在数据存储区中,一个实体只能有一个父级,但可以有多个子级。 But for your use case you may try to have a third kind, dept-store, and assign its properties as the keys of the entities from the department and the store kinds. 但是对于您的用例,您可以尝试拥有第三种类型的百货商店,并将其属性分配为部门和商店类型中实体的键。 This solution might need a good understanding of your neeeds for implementation, as Datastore by nature is Non-relational database. 该解决方案可能需要对实现的需求有充分的了解,因为数据存储本质上是非关系数据库。
You can lookup multiple entities providing the keys retrieved from kind1 and kind2 with batch operations [ 2 ]. 您可以查找多个实体,并通过批处理操作[ 2 ]提供从kind1和kind2检索到的密钥。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.