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
Improve handling of MongoDB ObjectIDs as OPTIMADE immutable_id
#1142
Conversation
576ebbf
to
8ff8615
Compare
Codecov Report
@@ Coverage Diff @@
## master #1142 +/- ##
==========================================
+ Coverage 92.32% 92.41% +0.09%
==========================================
Files 68 68
Lines 3894 3904 +10
==========================================
+ Hits 3595 3608 +13
+ Misses 299 296 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@JPBergsma would you be able to take a look at this at some point today? I think we should try to get it into v0.17 as it could be quite significant speed-up in certain scenarios |
73e197e
to
723ff87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I did not see your request to review it sooner.
It got lost in the flood of github messages in my inbox.
I did not see anything wrong with it.
optimade/validator/config.py
Outdated
@@ -74,7 +74,7 @@ | |||
DataType.STRING: inclusive_ops + substring_operators, | |||
DataType.TIMESTAMP: ( | |||
# N.B. "=" and "<=" are disabled due to issue with microseconds stored in database vs API response (see Materials-Consortia/optimade-python-tools/#606) | |||
# ">=" is fine as all microsecond trimming will round times down | |||
# ">=" is fine as all microsecond trimming will round times down |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you accidentally added a tab here
# ">=" is fine as all microsecond trimming will round times down | |
# ">=" is fine as all microsecond trimming will round times down |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually intentional to stop the operator in the second line flowing with the inline comments underneath (which are just commented out functionality). Maybe a linebreak/moving the comment above would be clearer
Thanks @JPBergsma and np, lots of notifications yesterday 🙃 I'll address your comment and merge without a futher review. |
723ff87
to
80350a2
Compare
80350a2
to
3a03ca3
Compare
immutable_id
immutable_id
immutable_id
Currently, we loop over the entire cursor and check whether the
_id
projection was requested, which is very inefficient. This PR makes some fixes around that:toString
projection if_id
is requested (and only do the inefficient loop if using mongomock).immutable_id
field (except equality).immutable_id
field to a string in the models.immutable_id
in our test cases.