Hi all,

I am having trouble trying to do a keys only query in python, using the 
same db.Query object.
Its able to fetch the key for the first query but none for the second 
althought the property is valid.
but it works fine if I create a new object and use it. Please find the 
usecase below.

#This is my model
class Test(db.Model):
    name = db.StringProperty()


b1 = Test.all().filter('name','abc').get()
b2 = Test.all().filter('name','def').get()

print b1.bizname #This prints :abc
print b2.bizname #This prints :def

#creating a keys only query
#and filtering on same query object(here q)
q = db.Query(model_class=TestModel.Biz, keys_only=True)
b3 = q.filter('name', 'abc').get()
b4 = q.filter('name', 'def').get()

print b3 #prints the key
print b4 #prints None

# the same as above with abc and def reversed
q = db.Query(model_class=TestModel.Biz, keys_only=True)
b7 = q.filter('name', 'def').get()
b8 = q.filter('name', 'abc').get()

print b7 #prints the key
print b8 #prints None

#doing the same thing with different query object
q1 = db.Query(model_class=biz_model.Biz, keys_only=True)
b5 = q1.filter('name', 'abc').get()
q2 = db.Query(model_class=biz_model.Biz, keys_only=True)
b6 = q2.filter('name', 'def').get()
print b5 #prints the key
print b6 #prints the key


Any explanation will be greatly appreciated.


regards,
Joy

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/kT9x0XplcGkJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to