Skip to content

fix: raise CompileError on unsupported TIME type compilation (#79) - #84

Open
dwaddle wants to merge 1 commit into
databendlabs:mainfrom
dwaddle:fix/time-type-compile-error
Open

dwaddle wants to merge 1 commit into
databendlabs:mainfrom
dwaddle:fix/time-type-compile-error

Conversation

@dwaddle

@dwaddle dwaddle commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #79

Databend does not possess a native time-of-day (TIME) data type. Previously, DatabendTypeCompiler.visit_TIME returned "DATETIME". When users defined a table with SQLAlchemy Time columns, the dialect rendered them as DATETIME, silently creating columns that prepended an artificial 1970-01-01 date prefix to stored values. While a typed Core select() reconstituted a datetime.time object, any generic reader, inspector, or schema reflection saw a DATETIME holding a synthetic 1970 date.

This pull request updates DatabendTypeCompiler.visit_TIME to explicitly raise CompileError when compiling Time columns, clearly informing users that Databend does not support the TIME data type and guiding them to use TIMESTAMP or VARCHAR. In addition, requirements.py marks time and time_microseconds as closed.

Key Changes

  • databend_sqlalchemy/databend_dialect.py: Import CompileError from sqlalchemy.exc and raise CompileError in DatabendTypeCompiler.visit_TIME.
  • databend_sqlalchemy/requirements.py: Mark time and time_microseconds as exclusions.closed().
  • tests/unit/test_databend_dialect.py: Add test_visit_time_raises_compile_error verifying CreateTable raises CompileError when encountering Time columns.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T06:48:22.574228Z 486895e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

Time is rendered as DATETIME, so a time-of-day is silently stored as a 1970-01-01 timestamp

1 participant