Question

I want to have a condition something like

  • start_time <= start_time_input <= end_time
  • OR
  • start_time <= end_time_input <= end_time
  • OR
  • (start_time_input <= start_time AND end_time <= end_time_input )

The 2 ways as identified in the docs ( http://code.google.com/appengine/docs/python/datastore/queries.html and http://code.google.com/appengine/docs/python/datastore/gqlqueryclass.html)as I understood are :

filter_trips = db.GqlQuery("SELECT key FROM Trips WHERE ( start_time <= :start_time_input AND end_time >= :start_time_input ) OR (start_time <= :end_time_input AND end_time >=:end_time_input ) OR ( start_time >= :start_time_input AND end_time <= :end_time_input )" , start_time_input = start_time_input , end_time_input = end_time_input )

error: Parse Error: Invalid WHERE Identifier at symbol (

OR

filter_trips = db.GqlQuery("SELECT key FROM Trips WHERE start_time <= :start_time_input <= end_time OR start_time <= :end_time_input <= end_time OR (:start_time_input <= start_time AND end_time <= :end_time_input )" , start_time_input = start_time_input , end_time_input = end_time_input )

error: Parse Error: Expected no additional symbols at symbol <=

Please help!

Was it helpful?

Solution

GQL doesn't have an OR. See http://code.google.com/appengine/docs/python/datastore/gqlreference.html

You'll need to do this as multiple queries.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top