I have been struggling with this for a couple of days and I am touching 
down. 

I have this (simplified for the case):

class PatientDB ( ndb.Model ):
    name        = ndb.StringProperty( )
    doctor      = ndb.KeyProperty( )

class SurveyDB ( ndb.Model ):
    date         = ndb.IntegerProperty( )
    survey_spec  = ndb.KeyProperty( kind=SurveySpecDB )
    answers      = ndb.StructuredProperty( SurveyAnswerDB, repeated=True )


A SurveyDB is created with PatiendDB Key as parent. Additionally, the 
SurveyDB has a survey specification (survey_spec) that is a list of 
questions and the possible replies.

They query to retrieve the surveys is like:

    query = SurveyDB.query( SurveyDB.survey_spec == survey_key, ancestor = 
patient.key ).order( -SurveyDB.date )

Notice that it is a query that implies ANCESTOR and a KEY. Other ways of 
writing the same (all tested):

   query = SurveyDB.query( ancestor = patient.key ).filter( 
SurveyDB.survey_spec == survey_spec ).order( -SurveyDB.date )
   query = ndb.gql( "SELECT * FROM SurveyDB WHERE ANCESTOR IS :1 AND 
survey_spec = :2 ORDER BY date DESC", patient.key, survey_spec )

By running this query *on the server* I get *ZERO* results. *In the 
appengine.google.com webpage I get the correct results*.

Extra things:
- removing the "order" does not do anything

- The index exists and it serving:
  - kind: SurveyDB
    ancestor: yes
    properties:
    - name: survey_spec
    - name: date
      direction: desc

- Simplifying the query to just use ancestor OR just use the survey_spec 
returns data


am I missing something or is this a bug?

Thans for any light!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to