2 messages in com.googlegroups.google-appengine[google-appengine] Problems in query ...| From | Sent On | Attachments |
|---|---|---|
| Garrett Davis | 29 May 2008 19:07 | |
| Marzia Niccolai | 30 May 2008 12:26 |
| Subject: | [google-appengine] Problems in query with 'order by' multiple fields![]() |
|---|---|
| From: | Garrett Davis (Garr...@gmail.com) |
| Date: | 05/29/2008 07:07:13 PM |
| List: | com.googlegroups.google-appengine |
My latest enhancement to my app worked fine on my local machine - but would not display any data when it was deployed to the 'cloud'.
The app ran a query which should have returned, and displayed, all the items for a given 'kind', with 'order by' clause specifying three fields. It works fine on the local dev_appserver, but the 'cloud' server returns no results and no error condition - or nothing my app detected.
I was able to reproduce the problem, or create a similar problem, using queries on the admin console. Can you take a look at these queries below, all run on the admin console, and tell me if I did something dumb (hey, it was 3am), or if there is something wrong with queries?
My app is named 'gawsh', and the object is named 'ReRef'. I 'seeded' the datastore with six entities / instances / (rows) and have not updated them. The data model is defined as follows:
class RerefDm(gawsh_model.GawshDataModel): # subclass of db.Model
_kind_name = 'ReRef' # I have a Def Kind() that returns this as the 'kind'; it seems to work ok
name = db.TextProperty(required=True) locn = db.IntegerProperty(required=True, choices=LOCATION_CHOICES) valu = db.IntegerProperty(required=True, choices=VALUE_CHOICES) use = db.IntegerProperty(required=True, choices=PROPUSE_CHOICES) svc = db.IntegerProperty(required=True, choices=SERVICE_CHOICES) rank = db.IntegerProperty(required=True, default=0) postaddr = db.TextProperty() descrip = db.TextProperty() phone = db.StringProperty() email = db.StringProperty() website = db.StringProperty()
# and for those of you who have seen or heard about my model definition using YAML - no, this model was defined using vanilla Python.
Query #1: select * from ReRef order by rank desc, name, locn
response ... No results.
----------
Query #2: select * from ReRef order by rank desc, name [same query, 'order by' one fewer field] response ... [error message] « no matching index found This query needs this index: - kind: ReRef properties: - name: rank direction: desc - name: name [and] No results.
----------
Query #3: select * from ReRef order by rank desc [same query, 'order by' only one field] response ... this time, it correctly displays the (six) entities in the datastore.
ok: I understand the error message generated by Query #2. I had never tried this query locally, so nobody told the 'datastore in the cloud' to build an index to support it.
But why did Query #1 return 'no results' and no error message?
There should have been indexes to support queries #1 and #3. Here's an excerpt from index.yaml:
- kind: ReRef properties: - name: rank direction: desc
- kind: ReRef properties: - name: rank direction: desc - name: name - name: locn
Thanks in advance for any help you can supply, and apologies in advance if I actually did something dumb. Gary Davis
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to goog...@googlegroups.com
To unsubscribe from this group, send email to
goog...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---




