juliotrigo / sqlalchemy-filters

Filter, sort and paginate SQLAlchemy query objects. Ideal for exposing these actions over a REST API.
Other
325 stars 75 forks source link

Datetime comparison not working? #55

Closed javimudi closed 4 years ago

javimudi commented 4 years ago

Hi,

I've been successfully using this excellent tool for a few months and this is the very first time I find myself in need of using datetime-based filters.

I'm trying to apply a range but the resulting query doesn't seem to be what I was expecting.

The filter itself looks like: [{'model': 'Job', 'field': 'dueDate', 'operator': 'gt', 'value': datetime.datetime(2008, 6, 1, 0, 0)}]

Which is later on rendered as:

WHERE job."dueDate" = %(dueDate_1)s

So, the filter is somewhat applied, but with the wrong operator.

I'm open to provide extended data if required.

Thanks a lot for your help.

Cheers, Javier