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

fix datetime64 parsing #189

Closed
wants to merge 1 commit into from

Conversation

rubemz
Copy link
Contributor

@rubemz rubemz commented Aug 14, 2024

This is a PR to fix DateTime64 when defined in the schema as:

 field(:timestamp, Ch, type: "DateTime64(3)")

This is what is happening afaik:

  • dumper returns :naive_datetime_usec here
  • ecto transforms the given DateTime as NaiveDateTime here

The code I changed in ecto_ch returns DateTime as param_type instead of DateTime64(<precision>)

My test suite is erroring (without this fix) with:

  ** (Ch.Error) Code: 457. DB::Exception: Value 2024-08-14T20:55:30.094116 cannot be parsed as DateTime for query parameter '$1' because it isn't parsed completely: only 19 of 26 bytes was parsed: 2024-08-14T20:55:30. (BAD_QUERY_PARAMETER) (version 23.12.1.1368 (official build))

I added a test that raises a similar error and fixed it with a very similar code change that was recently introduced to support DateTime64

@ruslandoga
Copy link
Contributor

👋 @rubemz

Thank you!

I changed the tests a bit and re-applied your fix in #191

@ruslandoga ruslandoga closed this Aug 15, 2024
@rubemz
Copy link
Contributor Author

rubemz commented Aug 15, 2024

@ruslandoga thanks a lot!

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

Successfully merging this pull request may close these issues.

2 participants