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

Abierto
#79 0 comentarios 0 reacciones 0 asignados Ver en GitHub

@dwaddle ya está trabajando en esto.

Desde el 22/10/2026.

  • #84 de @dwaddle — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
58/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
python, sqlalchemy
Área
database

Línea de trabajo

Empieza reproduciendo el CREATE TABLE y las lecturas tipadas o no tipadas descritas en el issue; después, sigue el punto de entrada de compilación del dialecto para el tipo Time de SQLAlchemy Core. Se considera terminado cuando un Time no compatible se rechaza en tiempo de compilación o usa TEXT sin inventar una fecha; la reflexión y las lecturas genéricas no deben exponer silenciosamente una marca de tiempo 1970-01-01.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
15
Forks
5
Merge medio
1 d 15 h
PR fusionados (30 d)
1

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de databendlabs/databend-sqlalchemy

Todos los issues de databendlabs/databend-sqlalchemy

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.