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

オープン
#79 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@dwaddle がすでに取り組んでいます。

2026年10月22日 から。

  • #84 @dwaddle による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python, sqlalchemy
領域
database

調査の方向性

まず、issue に記載されている CREATE TABLE と型付きまたは型なしの読み取りを再現し、次に SQLAlchemy Core の Time 型に対する dialect のコンパイルエントリポイントを追跡します。未サポートの Time がコンパイル時に拒否されるか、日付を勝手に作らずに TEXT を使用すれば完了です。reflection と汎用的な読み取りで、1970-01-01 のタイムスタンプが暗黙的に公開されてはなりません。

索引モデルが issue の本文から書いたものです。

説明

Versions

  • databend-sqlalchemy 0.5.5
  • databend-driver 0.34.2
  • SQLAlchemy 2.0.51
  • Python 3.12.9, macOS
  • Server: datafuselabs/databend:v1.2.925-patch-4 in Docker

What happens

Databend has no time-of-day type. Its parser says so by listing what it will take:

CREATE TABLE probe (clock TIME)
-> unexpected `TIME`, expecting `TIMESTAMP`, `TIMESTAMP_TZ`, `TEXT`, … `DATE`, … `DATETIME`, …

The dialect renders Core's Time as DATETIME. The column is created, and the substitution is invisible from Core, because SQLAlchemy's own Time type re-derives the value on the way out:

  • typed select() on the column hands back time(14, 30) — looks correct
  • the same column read without the Core type in play is 1970-01-01T14:30:00Z
  • inspect() reports the column type as DATETIME

So it round-trips correctly through a typed Core select and is wrong through everything else: reflection, any consumer reading the column generically, anything comparing against another engine's storage of the same value.

Why this is the awkward failure mode

A column that couldn't be created is a five-minute problem. A column that exists and quietly holds a different type is the kind that surfaces months later, in whichever consumer wasn't going through Core's typed path. The date part isn't neutral either — it's a real 1970-01-01 sitting in the data, and it sorts and compares as one.

Suggested fix

Refuse Time at compile time on an engine that has no such type, the same way an unsupported type is refused elsewhere. If a substitution is preferred over a refusal, TEXT at least doesn't invent a date, but I'd rather it just raised.

主要言語
Python
スター
15
フォーク
5
平均マージ
1日 15時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

databendlabs/databend-sqlalchemy のほかの issue

databendlabs/databend-sqlalchemy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。