当我在 GQL 中使用 OR 条件时,它返回错误消息“ BadQueryError: Parse Error: Expected no additional symbols at symbol OR。为什么?
db.GqlQuery("Select * from vendor where access='public' OR organisation_id='"+ orgid +"'")
当我在 GQL 中使用 OR 条件时,它返回错误消息“ BadQueryError: Parse Error: Expected no additional symbols at symbol OR。为什么?
db.GqlQuery("Select * from vendor where access='public' OR organisation_id='"+ orgid +"'")
GQL does not have an OR operator. However, it does have an IN operator,
which provides a limited form of OR.
Docs 明确表示 GQL 没有 OR 运算符。
你可以做这样的事情......进行两个查询并组合结果......
vendors=vendor.all()
pub_vendors = vendors.filter("access = ","public")
vendors=vendor.all()
org_vendors = vendors.filter("organisation_id = ",orgid)
results = pub_vendors.extend(org_vendors)