MSSQL connector fails to preview or import tables containing a `TIMESTAMP`/`ROWVERSION` column

Aperta
#473 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, sql
Ambito
databases

Direzione di ricerca

Locate the MSSQL connector code that generates SELECT queries for table preview and import. The error shows the connector implicitly converts TIMESTAMP/ROWVERSION to nvarchar(max), which SQL Server forbids. Modify the query generation to handle this data type—cast to VARBINARY or skip the conversion. Test with the reproduction table to confirm the fix.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment
  • Microsoft Data Formulator running in Docker
  • Ubuntu Server 24.04
  • Microsoft SQL Server 2022
  • MSSQL Python driver (mssql_python, as shown in the application log)
Description

When I try to preview or import a SQL Server table that contains a TIMESTAMP column, the operation fails. In SQL Server, TIMESTAMP is a synonym for ROWVERSION—it stores a binary row version, not a date or time.

Minimal reproduction
CREATE TABLE dbo.Repro (
    Id int NOT NULL PRIMARY KEY,
    RowVersionColumn timestamp NOT NULL,
    SysStartTime datetime2(7) GENERATED ALWAYS AS ROW START NOT NULL,
    SysEndTime datetime2(7) GENERATED ALWAYS AS ROW END NOT NULL,
    PERIOD FOR SYSTEM_TIME (SysStartTime, SysEndTime)
)
WITH (
    SYSTEM_VERSIONING = ON (
        HISTORY_TABLE = dbo.ReproHistory
    )
);
  1. Connect Data Formulator to the SQL Server database.
  2. Select dbo.Repro.
  3. Try to preview or import the table.
Expected behavior

The table should be previewed and imported successfully, with the ROWVERSION column handled as binary data or otherwise handled safely.

Actual behavior

Both preview and import fail with a data-load error. The SQL Server driver reports:

Invalid character value for cast specification;
[Microsoft][SQL Server] Explicit conversion of the timestamp data type
to nvarchar(max) is not allowed.

The error occurs while executing the generated SELECT query.

Lingua principale
Python
Stelle
17.7k
Fork
1.7k
Merge medio
4g 1h
PR unite (30g)
8

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/data-formulator

Tutte le issue di microsoft/data-formulator

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.