Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Engine's filter vs. gql methods

I have a user in my system who has created an entity which I'd like to retrieve. I'm attempting to do this using a filter because it's supposed to be faster than a call to the gql method. However, the filter returns no results and gql works.

randy_res = Vote.all().filter('created_by=', randy).fetch(limit=10)
randy_res = Vote.gql('WHERE created_by=:1', randy)

Is there any reason why the filter would return an empty list and the gql call would return the proper results?

like image 407
Matt Norris Avatar asked Jul 21 '10 22:07

Matt Norris


1 Answers

When using filter(), you are required to have a space between the field name and the operator. To get your filter() call to work as intended, you just need to insert a space before the equal sign:

randy_res = Vote.all().filter('created_by =', randy).fetch(limit=10)
like image 148
David Underhill Avatar answered Sep 22 '22 11:09

David Underhill