gpt4 book ai didi

google-app-engine - Appengine NDB : Putting 880 rows, 超出数据存储区写入操作配额。为什么?

转载 作者:行者123 更新时间:2023-12-01 22:23:27 25 4
gpt4 key购买 nike

我有一个使用 put_async() 将 880 行导入 NDB 数据存储的应用程序。每当我运行此导入时,它都会超出数据存储区每日 50,000 次写入操作的配额。

我试图了解为什么此操作如此昂贵以及可以采取哪些措施来保持在配额以内。

有 13 列,如下所示:

stringbool = ['true', 'false']
class BeerMenu(ndb.Model):
name = ndb.StringProperty()
brewery = ndb.StringProperty()
origin = ndb.StringProperty()
abv = ndb.FloatProperty()
size = ndb.FloatProperty()
meas = ndb.StringProperty()
price = ndb.FloatProperty()
active = ndb.StringProperty(default="false", choices=stringbool)
url = ndb.StringProperty()
bartender = ndb.StringProperty()
lineno = ndb.IntegerProperty()
purdate = ndb.DateProperty()
costper = ndb.FloatProperty()

我已将索引修剪回 1:

- kind: BeerMenu
properties:
- name: brewery
- name: name

根据 SDK 数据存储查看器,每行有 29 个写入操作,因此将生成 25520 个写入!我假设索引消耗了其余的写入操作,但我不知道到底有多少,因为 AppEngine 只是说我已经超出了配额。

减少写入操作数量的最佳策略是什么?

最佳答案

默认情况下,除文本和 blob 属性之外的所有属性都会建立索引。因此,如果取消字符串属性的索引,所有 float、int 和 date 属性仍会建立索引。您应该将 indexed=False 添加到其他属性以减少写入。

index.yaml 中列出的索引是属性索引的附加索引。 index.yaml 索引用于诸如有序查询和关系查询之类的内容(即,使用 date > date_property 的查询将在 index.yaml 中生成一个条目)。

关于google-app-engine - Appengine NDB : Putting 880 rows, 超出数据存储区写入操作配额。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17078702/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com