这有效:
from google.appengine.ext import ndb
query = ndb.gql("SELECT distinct id from Pocket")
query.fetch()
这也有效:
query = ndb.gql("SELECT id from Pocket where ancestor is :1")
query = query.bind(u.key)
这会引发错误:
query = ndb.gql("SELECT distinct id from Pocket where ancestor is :1")
query = query.bind(u.key)
错误是:
BadQueryError: Parse Error: Identifier is a reserved keyword at symbol ancestor
Python 的 NDB 不支持 GQL DISTINCT 祖先查询,还是这是一个错误?