-
Notifications
You must be signed in to change notification settings - Fork 116
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
Support time points as numeric indexes #240
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #240 +/- ##
==========================================
+ Coverage 77.25% 77.61% +0.36%
==========================================
Files 12 12
Lines 1165 1184 +19
==========================================
+ Hits 900 919 +19
Misses 265 265
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Any input will be appreciated |
This is a rough draft
What's is implemented:
datetime.datetime
works as numeric index.datetime.date
works as numeric index.datetime.time
works as numeric index.(very sketchy, see below)What can be added / improved:
datetime.time
custom parsing implementationdatetime.time
because user will have to write parsing(validation) themselves otherwise(seepost_model_time
in tests).datetime.timedelta
(I skipped it for now).Model.find(Model.field < "Thu Sep 25 10:36:28 2003")
or ISO format, or etc...Questions:
Right now I just convert everything to UTC before saving. (This needs to be checked)
Model.find(Model.field < "Thu Sep 25 10:36:28 2003")
or"2003-09-25T10:49:41.5-03:00"
or any other string in expressions. (Becausepydantic
supports only ISO format(I think)). We could usedateutil
. Or make it optional dependency.pydantic
parsing support parsingdatetime
from integers ms out of the box.redis-om-node
, and there they support precision to seconds(I'm not sure): https://github.com/redis/redis-om-node#searching-on-datesModel.datetime < date/time
). Should we support this? Or catch this and raise exception?Problems:
, very custom logic(probably wrong)Sketchy things:
datetime.time custom parsing implementationresolve_value
. Maybe there is better approach.Fixes #199