webo
webo

Reputation: 133

Gql query for repeated StructuredProperty

How do I write the following query in GQL? [1]

Contact.query(Contact.address == Address(city='San Francisco',
                                         street='Spear St'))

[1] Filtering for Structured Property Values

Upvotes: 1

Views: 176

Answers (1)

Alex Martelli
Alex Martelli

Reputation: 882691

Quoting https://cloud.google.com/appengine/docs/python/ndb/queries#gql , "To query models containing structured properties, you can use foo.bar in your GQL syntax to reference subproperties" -- so if I understand your task correctly,

'''SELECT * FROM Contact 
   WHERE address.city='San Francisco' AND
         address.street='Spear St'
'''

should work. Doesn't it?

Upvotes: 2

Related Questions