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

Make datetime.time json serializable, to string ISO format. #701

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

surister
Copy link

Summary of the changes / Why this is an improvement

Fixes #696

Checklist

  • Link to issue this PR refers to (if applicable): Fixes #???

@surister surister force-pushed the fix/datetime-time-serializable branch from c77c110 to a4fbe65 Compare February 25, 2025 08:22
@surister surister force-pushed the fix/datetime-time-serializable branch from a4fbe65 to 3b00367 Compare February 25, 2025 08:25
@surister surister requested review from amotl and seut February 25, 2025 09:02
@surister
Copy link
Author

Docs failing with https://cratedb.com/docs/crate/crash/en/latest/objects.inv < Error 503 first byte timeout

request.return_value = fake_response(200)

obj = dt.datetime.now().time()
client.sql("insert into my_table (str_col) values (?)", (obj,))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really testing that the time format is correct and understood by CrateDB as it will just take the given string and stores it.

Suggested change
client.sql("insert into my_table (str_col) values (?)", (obj,))
client.sql("SELECT ?::TIMETZ AS t_tz", (obj,))

Additionally, this would test the decoding of a TIMETZ type.

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.

TypeError: Type is not JSON serializable: datetime.time
2 participants