为什么我会得到“实体的索引过多的属性”错误只是为了列表中的18个项目? (蟒蛇) [英] Why do I get "Too many indexed properties for entity" error just for 18 items in the list? (Python)

查看:86
本文介绍了为什么我会得到“实体的索引过多的属性”错误只是为了列表中的18个项目? (蟒蛇)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表属性

  tag_list = db.StringListProperty()

到目前为止,这一直运行良好,但今天当我试图用18个条目写一个列表时,我得到了索引过多实体属性:错误。我认为这是一个爆炸索引的例子。



这是我的查询:

 
query.filter(owner =,user)

阅读文档我的理解是,如果列表中有2000多个项目,则会触发此错误。如果这是由18个项目引发的,那么,我在做什么错了,我该如何解决这个问题?

使用更多代码更新

  query = Main.all()
query.filter(url =,url)
query.filter(owner =,user)

e = query .get()

如果e:
e.tag_list = user_tag_list
e.pitch = pitch_original
e.title = title_ascii
e.put( )

main_id = e.key().id()

else:
try:
new_item = Main(
url = url,
tag_list = user_tag_list,
pitch = pitch_original,
owner = user,
#title = unicode(title,utf-8),
title = title_ascii,
display = True)
#这是错误发生在日志中的地方
new_item.put()

以下是列表:

  user_tag_list = [u'box ,u'jquery',u'working',u'enter',u'initially',u'text',u'showing',u'javascript',u'overflow',u'focus',u'stack' ,u'field',u'impossible',u'input',u'hidden',u'element',u'toggling',u'toggled'] 


解决方案

这是因为爆炸索引


I have a list property

tag_list = db.StringListProperty()

This has been working fine so far, but today when I tried to write a list with 18 items I got the Too many indexed properties for entity: error. I think this is a case of "exploding indexes."

This is my query:

query = Main.all()
query.filter("url =", url)
query.filter("owner =", user)

Reading the documentation my understanding is that this error will be triggered for cases where there are 2000+ items in the list. If this is triggered for 18 items, then, what am I doing wrong and how can I fix this? Thanks.

Update with more code:

    query = Main.all()
    query.filter("url =", url)
    query.filter("owner =", user)

    e = query.get()

    if e:
        e.tag_list = user_tag_list
        e.pitch = pitch_original
        e.title = title_ascii
        e.put()

        main_id = e.key().id()

    else:
        try:
            new_item = Main(
                url = url,
                tag_list = user_tag_list,
                pitch = pitch_original,
                owner = user,
                #title = unicode(title, "utf-8"),
                title = title_ascii,
                display = True)
            #this is where the error occurs in the logs              
            new_item.put()

And this is the list:

user_tag_list = [u'box', u'jquery', u'working', u'enter', u'initially', u'text', u'showing', u'javascript', u'overflow', u'focus', u'stack', u'field', u'impossible', u'input', u'hidden', u'element', u'toggling', u'toggled']

解决方案

This is because of exploding indexes.

这篇关于为什么我会得到“实体的索引过多的属性”错误只是为了列表中的18个项目? (蟒蛇)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆