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?
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With