Skip to content

Fix sa.Time() raising Cannot find data type: time on CrateDB#283

Open
florinutz wants to merge 1 commit into
mainfrom
fix/issue-206-sa-time
Open

Fix sa.Time() raising Cannot find data type: time on CrateDB#283
florinutz wants to merge 1 commit into
mainfrom
fix/issue-206-sa-time

Conversation

@florinutz

Copy link
Copy Markdown

CrateTypeCompiler had no visit_time, so sa.Time fell through to SQLAlchemy's generic compiler and emitted SQL-standard TIME. CrateDB has no storable time-of-day type: plain TIME doesn't exist, and TIME WITH TIME ZONE (TIMETZ) is literal/cast-only ("does not support storage"). sa.Date/sa.DateTime worked only because they already had overrides mapping to TIMESTAMP.

Closes #206.

Fix

Storing time-of-day as a STRING in ISO 8601 format — the same convention the crate driver already uses for datetime.time (see crate/crate-python#696):

A datetime.time now round-trips intact, including tz-aware values.

Tests

  • tests/create_table_test.py: DDL renders STRING instead of TIME
  • tests/datetime_test.py: live round-trip of a datetime.time

@florinutz florinutz requested review from bgunebakan and kneth June 26, 2026 15:39
@florinutz florinutz self-assigned this Jun 26, 2026
@florinutz florinutz added bug Something isn't working python Pull requests that update Python code labels Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1a21b149-2c00-4942-8133-f19a6f1a6ae9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-206-sa-time

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread tests/create_table_test.py Dismissed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLParseException[Cannot find data type: time]

3 participants