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

Missing support for timestamps/datetime in grammar #102

Closed
CasperWA opened this issue Nov 29, 2019 · 3 comments
Closed

Missing support for timestamps/datetime in grammar #102

CasperWA opened this issue Nov 29, 2019 · 3 comments
Assignees
Labels
grammar Concerns the Lark grammar files help wanted Extra attention is needed

Comments

@CasperWA
Copy link
Member

The grammar is currently missing support for timestamps (or datetime.datetime in terms of Python types).

The relevant section in the spec may be found here.

Specifically we need to recognize timestamps as values being of the form specified by RFC 3339 Internet Date/Time Format and then turn them into datetime.datetime objects if they are OK, otherwise, the implementation should return a 400 Bad Request.

@CasperWA CasperWA added help wanted Extra attention is needed grammar Concerns the Lark grammar files labels Nov 29, 2019
@CasperWA CasperWA added this to To do in Road to optimade-python-tools 1.0 via automation Nov 29, 2019
@CasperWA CasperWA changed the title Missing support for datetime Missing support for timestamps/datetime in grammar Nov 29, 2019
@CasperWA CasperWA added this to the OPTiMaDe v0.10.0 milestone Dec 22, 2019
@fekad
Copy link
Contributor

fekad commented Jun 10, 2020

This is a tricky one: The grammar is perfectly aligned with the specification and interprets the datetime as a string (There is nothing missing there)

As far as I can see there are two possible solutions:

  • In the case of MongoDB you could say that if you have a comparison (<,>,etc.) with a string that string can only be a datetime oject because - as far as I know - mongodb doesn't support string comparisons, but you will still have problem with the = operator. This approach could also be too restrictive for other backends...
  • Somehow you must define which properties are timestamp properties and you parse only those if there is a comparison with them. The parsing could happen in the FilterTransformer but keeping in mind that the names of the datetime properties depend on which endpoint you query.

@CasperWA
Copy link
Member Author

In agreement in room 4 (CECAM 2020), this will be implemented in the FilterTransformer, possibly as a pre-processing matching the properties with datetime type values.

@ml-evs
Copy link
Member

ml-evs commented Nov 15, 2021

In agreement in room 4 (CECAM 2020), this will be implemented in the FilterTransformer, possibly as a pre-processing matching the properties with datetime type values.

Closing this for the reasons above: FilterTransformers now have access to field types and can appropriately handle the OPTIMADE timestamp type.

@ml-evs ml-evs closed this as completed Nov 15, 2021
Road to optimade-python-tools 1.0 automation moved this from To do to Done Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grammar Concerns the Lark grammar files help wanted Extra attention is needed
Development

No branches or pull requests

3 participants