开发者

App Engine's filter vs. gql methods

开发者 https://www.devze.com 2023-01-08 02:56 出处:网络
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,

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)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号