Doing gql.query and not getting any results when I KNOW from looking at the datastore that there is a matching entry — anyone ? maybe it has to do with the format of my variables?
for each in leveloneAdd:
new = tuple(each[1:-1].split(','))
tag = new[0]
htype = new[1]
q1 = Level_1_Headings.all().filter("name1 =",tag).filter("heading_type =",htype).get()
So in my logs: have confirmed that values of variables are as follows:
INFO 2013-01-14 20:28:38,370 main.py:293] new is (u"'english'", u" 'subject'")
INFO 2013-01-14 20:28:38,370 main.py:295] tag is 'english'
INFO 2013-01-14 20:28:38,370 main.py:297] heading type is 'subject'
Also have confirmed that entry does exit (both name1 and heading_type are indexable)
Looking at your tuple, you appear to have strings that contain quotes:
Therefore when you try to query them, you are querying
'english'instead ofenglish, which I’m assuming you want. Try stripping out the quotes from your original string if possible to see if the result returns as expected. You can see the difference here:To fix it, you could try something like this (note: you have a leading space in front of
subject, so you may need to adjust for that):