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

TypeError: Type is not JSON serializable: datetime.time #696

Open
surister opened this issue Feb 10, 2025 · 2 comments · May be fixed by #701
Open

TypeError: Type is not JSON serializable: datetime.time #696

surister opened this issue Feb 10, 2025 · 2 comments · May be fixed by #701
Labels
needs: feedback An issue that needs feedback triage An issue that needs to be triaged by a maintainer

Comments

@surister
Copy link

surister commented Feb 10, 2025

Reproduce: Try to send a datetime.time object to CrateDB.

With the new orjson we pass datetime objects to our custom json_encoder, datetime.time is not handled.

@amotl amotl added bug triage An issue that needs to be triaged by a maintainer needs: feedback An issue that needs feedback and removed bug labels Feb 10, 2025
@amotl
Copy link
Member

amotl commented Feb 10, 2025

Thanks for reporting. Did it work well with the previous package version crate<2 to submit Python's datetime.time objects to CrateDB, where orjson has not been involved?

@surister
Copy link
Author

I would say no, we still didn't handle datetime.time objects in the past,

def default(self, o):

I'd say that the solution is to just cast the object to datetime.time.isoformat()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: feedback An issue that needs feedback triage An issue that needs to be triaged by a maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants