Search code examples
pythongoogle-app-enginegqlgqlquery

OR Condition Return Error in GQL ( Google app engine) Why?


When i use the OR condion in GQL it return error messege tht "BadQueryError: Parse Error: Expected no additional symbols at symbol OR . Why?

db.GqlQuery("Select * from vendor where access='public' OR organisation_id='"+ orgid +"'")

Solution

  •     GQL does not have an OR operator. However, it does have an IN operator, 
    which provides a limited form of OR.
    

    Docs clearly says that GQL doesn't have an OR operator..

    You could do something like this ..Make two queries and combine the results...

      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)