I am trying to compare the key to filter results in gql in python but the direct comparision nor typecasting to int works. There fore I am forced to make a work around as mentioned in uncommented lines below. Any clues.
row = self.request.get("selectedrow")
#mydbobject = DbModel.gql("WHERE key=:1", row).fetch(1)
#mydbobject = DbModel.gql("WHERE key=:1", int(row)).fetch(1)#invalid literal for int() with base 10
#print mydbobject,row
que = db.Query(DbModel)
results = que.fetch(100)
mydbobject = None
for item in results:
if item.key().__str__() in row:
mydbobject = item
EDIT1- one more attempt that does not retrieve the record, the key exists in datastore along with record mydbobject = DbModel.gql("WHERE key = KEY('%s')"%row).fetch(1)