NeedIndexError, but index is in index.yaml file

26 views
Skip to first unread message

djidjadji

unread,
Sep 21, 2008, 10:50:12 AM9/21/08
to google-a...@googlegroups.com
I have a BarB object that is the parent of a couple of FooA objects.
I want to find all the FooA objects that have a certain parent and
that have an "myID < 0"

barB = BarB.get_by_key_name(keyname)
result = FooA.all().ancestor(barB).filter('myID <', 0)

When I test it on the devappserver v1.1.3 it works correct, and an
entry in index.yaml is made

=======================
- kind: FooA
ancestor: yes
properties:
- name: myID
=======================

When I upload the new code and try it out I get the following error:

=======================
NeedIndexError: no matching index found.
This query needs this index:
- kind: FooA
ancestor: yes
properties:
- name: myID
=======================

When I look in the Dashboard this index is "Serving". And it tells the
index is Ascending sorted, this is maybe the default.

What is the cause of this error?

Djidjadji

Alexander Kojevnikov

unread,
Sep 21, 2008, 8:33:35 PM9/21/08
to Google App Engine

Marzia Niccolai

unread,
Sep 22, 2008, 1:08:52 PM9/22/08
to google-a...@googlegroups.com
Hi,

From the description, it seems as though Alexander is correct, and you are experiencing the below issue.

However, if you would like to reply directly to me with the App Id, I can look in to it and verify if it is this or something else may be happening.

Thanks,
Marzia

djidjadji

unread,
Sep 22, 2008, 7:30:30 PM9/22/08
to google-a...@googlegroups.com
Hi Marzia,

Yes Alexander is correct.

I have read the issue and have exact the same problem.
In my index.yaml file there is also the following entry as the first
index, placed by devappserver.py.


=======================
- kind: FooA
ancestor: yes

=======================
This is because in some cases I want all the FooA objects that have a
certain parent.
But sometimes I just need a selection of them, and what I heard from a
Google IO talk was
"If you can: let the Datastore work for you" that is why I added the
filter() call.
But to work around the bug I have done the work myself and implemented
the filter
with python if-statement. At the moment the parent does not have a lot
of FooA childs but that might not be the case in the future ( and then
I get hit by the CPU quota ;-)

djidjadji

2008/9/22 Marzia Niccolai <ma...@google.com>:

Alexander Kojevnikov

unread,
Sep 22, 2008, 9:54:51 PM9/22/08
to Google App Engine
Marzia,

Can we expect this to be fixed any time soon? This bug is very
annoying. As mentioned by djidjadji, workarounds can be very resource-
intensive. Usage of indices (vs manual filtering) is encouraged in the
docs, but this bug makes it impossible with a very obscure error
message.

Thanks!
Alex

--
http://www.muspy.com

On Sep 23, 4:08 am, "Marzia Niccolai" <ma...@google.com> wrote:
> Hi,
>
> From the description, it seems as though Alexander is correct, and you are
> experiencing the below issue.
>
> However, if you would like to reply directly to me with the App Id, I can
> look in to it and verify if it is this or something else may be happening.
>
> Thanks,
> Marzia
>
> On Sun, Sep 21, 2008 at 5:33 PM, Alexander Kojevnikov <
>
Reply all
Reply to author
Forward
0 new messages