Question

I am not able to query on datetime fields in google app engine. I am trying to run the following query -

SELECT * FROM Email WHERE cmp_id='52d836ed1057c341b800013a' AND pushed_to_crm=TRUE AND ss_time >= DATETIME('2014-01-17 00:00:00')

I am sure that this should return some rows - I mean that there is data in the database that should be returned.

But I get an error in running this query -

Learn more about GQL syntax.
no matching index found.
The suggested index for this query is:
- kind: Email
  properties:
  - name: cmp_id
  - name: pushed_to_crm
  - name: ss_time

The field ss_time is db.DateTimeProperty(). Is there something that I am missing?

Was it helpful?

Solution

The error message is quite clear. You have to add index for your Email entity with the following attributes: cmp_id, pushed_to_crm and ss_time.

You can do that by adding the following to your index.yaml:

- kind: Email
  properties:
  - name: cmp_id
  - name: pushed_to_crm
  - name: ss_time
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top