문제

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top