Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter on DateTime and Time sqlalchemy column types #37

Open
asabellico opened this issue Jun 7, 2019 · 2 comments
Open

filter on DateTime and Time sqlalchemy column types #37

asabellico opened this issue Jun 7, 2019 · 2 comments
Labels

Comments

@asabellico
Copy link

Hello!

I'm currently using this library but it seems like I'm not able to use operators gt and eq on sqlalchemy's Time column type.

I guess it is comparing using the value string representation of the information.. am I right? Is there a way to override the comparator for a particular column or at least override it globally?

Thank you

@juliotrigo
Copy link
Owner

Hi @asabellico , I'm glad you're using the library! Please let me take a look at it to see exactly what the behaviour is and how we could improve it.

@juliotrigo
Copy link
Owner

juliotrigo commented Jun 22, 2019

Hi @asabellico, I've taken a look at both datetime.time and datetime.datetime objects passed as filters to apply_filters and I can't see any problems with that on either MySQL or PostgreSQL.

Are you using a different DBMS (maybe SQLite)? If not, can you please provide an example of how you're trying to use it and how it fails (including the version of the DBMS you're using)?

You can see an example of datetime filters (passed as datetime objects) in the TestDateTimeFields class here https://github.com/juliotrigo/sqlalchemy-filters/blob/master/test/interface/test_filters.py#L760

I have also added some extra logic to test both datetime.time and datetime.datetime objects, also using isoformat ('03:05:09', '2016-07-14T03:05:09'): #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants