【问题标题】:Delete entity in google datastore in python在python中删除谷歌数据存储中的实体
【发布时间】:2017-07-06 14:04:38
【问题描述】:

我想根据电子邮件删除/修改谷歌云数据存储中的实体。

email = 'john@gmail.com'
query = client.query('email', '=', email)
# delete this entity if it exists??

现在我有了这个查询,我该如何删除这个实体?

【问题讨论】:

    标签: python google-cloud-datastore google-cloud-platform


    【解决方案1】:
    next_entity = query.fetch()
    client.delete(next_entity.key)
    

    如果您只是删除实体并且除了键之外不需要任何其他内容,请考虑执行keys_only 查询以避免读取您不关心的数据。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-06
      • 1970-01-01
      相关资源
      最近更新 更多