Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26647

Is >= working for comparing date variables?

I'm filtering on the created property which is a datetime variable comparing it to a date variable. Will >= work here since I'm looking for all the orders including the startdate?

orders = model.Order.all().filter('distributor_id =',
                        person.key.id()).filter('created >',
                        startdate)

So if I'm correct then what I should be doing is

orders = model.Order.all().filter('distributor_id =',
                        person.key.id()).filter('created >=',
                        startdate)

Is the above change allowed / recommended? It seems to work for datetime but when I try it with the data variable I get an error message.

Thank you

Upvotes: 0

Views: 185

Answers (1)

proppy
proppy

Reputation: 10504

Google App Engine SDK and NDB implementation shows that Datetime are represented as int64 in the datastore, so >= filter should works as expected.

Upvotes: 1

Related Questions