Google App Engine Datastore query problem -


I have the following problem:

I want to retrieve all the products in a category

category class (emodel): name = db.StringProperty () class channel (emodel): name = db.StringProperty () category = db.ReferenceProperty (category, collection_name = "cat_set") category product (Emodel): name = db.StringProperty () channel = db.ReferenceProperty (channel, collection_name = "ch_set")

Now I would like to write a GCL query which omits all refraction For the example category:

  Product.gql (" WHERE channel.category == Key (: 1) ", category_selected_key)  

Keep in mind that each channel can often change its range, so I want to avoid something extra for the CPU

You can not query 'nested' with GQ Where you filter property of referenced entity such as SQL (using any included).

Because in your reference, the product unit only stores the key of the referenced channel unit, which you must first do another query in order to obtain the key of the square trying to retrieve it:

>

  selected_channel = Channel.gql ("WHERE category =: 1", category_selected_key) .get () category_products = Product.gql ("where channel =: 1", selected_channel) .fetch ()  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -