Index for Datastore model with kind different than class name

60 views
Skip to first unread message

Nicolas Oteiza

unread,
Jul 27, 2017, 4:29:55 PM7/27/17
to Google App Engine
Hi!

I have a model with a different "kind" than the class name, like:

class TripDS(ndb.Model):

    @classmethod
    def _get_kind(cls):
        return "Trip"

When I query `TripDS`, with a complex query, I get an error saying I need an index.

If I deploy and wait for the index to be built like this:

```
- kind: Trip
  properties:
  - name: firstProperty
  - name: secondProperty
```

The index is built, but still the application throws an error whenever I try the complex query. If I deploy it with the kind `TripDS` then it works correctly.

I'm not sure this is expected behavior, as the name of the entity kind in the datastore is `Trip` not `TripDS`. And also, if I inspect the index, I see the `Trip` index has a size>0, and the `TripDS` index has a size=0.

What I suspect is happening is that the index is really built when I deploy with kind `Trip`, but then the error still is thrown because appengine is trying to find an index with the name of the model class instea of the model type.

Am I right? Is this a bug?

Kenworth (Google Cloud Platform)

unread,
Jul 27, 2017, 9:05:24 PM7/27/17
to Google App Engine
Based on the information you provided, when:

1- kind = "Trip"
    a. Deployment is ok
    b. The index is built
    c. Complex query call results to error

2- kind = "TripDS" => can you clarify what you meant with "then it works correctly"? Do you mean
    a. Deployment is ok?
    b. The index is built?
    c. Complex query call results to no error?
    d. Clarify as necessary


Nicolas Oteiza

unread,
Aug 3, 2017, 2:46:01 PM8/3/17
to Google App Engine
When I deploy an index with:

* kind = "Trip"
    a. Deployment is ok
    b. The index is built (index size > 0)
    c. Complex query call results to error

and when I deploy an index with:

* kind = "TripDS"
    a. Deployment is ok
    b. The index is built (index size = 0)
    c. Complex query call results to no error

Kenworth (Google Cloud Platform)

unread,
Aug 3, 2017, 11:20:11 PM8/3/17
to Google App Engine
Thank you for providing more information. I recommend posting this issue on Public Issue Tracker for further investigation and better tracking purposes. Please refer to this thread as background on the issue tracker.
Reply all
Reply to author
Forward
0 new messages