Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

bug(migrations): quoted version_table renders invalid CREATE TABLE

Chiusa Adatta ai principianti
#815 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
postgresql, python, sql
Ambito
databases

Direzione di ricerca

Inizia in sqlspec/migrations/base.py da BaseMigrationTracker._split_version_table, quindi esamina _tracking_table_builder e l’esempio di SyncMigrationTracker in sqlspec/migrations/tracker.py. Riproduci il problema con l’input App.Tracker tra virgolette e il DDL di postgres; il lavoro è completato quando CREATE TABLE usa "App"."Tracker" senza virgolette raddoppiate e le altre istruzioni del tracker usano la stessa tabella.

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

Descrizione

A quoted migration version_table name produces invalid CREATE TABLE SQL. The quotes around each part are kept, then quoted again when the DDL is rendered.

Reproduce

from sqlspec.migrations.tracker import SyncMigrationTracker

tracker = SyncMigrationTracker('"App"."Tracker"')
print(repr(tracker.version_table_name), repr(tracker.version_table_schema))
# '"Tracker"' '"App"'
print(tracker._tracking_table_ddl().build(dialect="postgres").sql.splitlines()[0])
# CREATE TABLE IF NOT EXISTS """App"""."""Tracker""" (

Expected

CREATE TABLE IF NOT EXISTS "App"."Tracker" (, with the tracker's other statements referring to the same table.

Cause

BaseMigrationTracker._split_version_table (sqlspec/migrations/base.py) splits on the dot but leaves the double quotes on each part. The DDL builder in _tracking_table_builder then treats the quotes as part of the name and escapes them. Any adapter that uses the generic tracker DDL is affected. To fix it, strip the quotes when splitting and keep a flag saying the name was quoted, so the table is still created with its exact case.

Lingua principale
Python
Stelle
102
Fork
9
Merge medio
16h 30m
PR unite (30g)
77

Preparare l'ambiente

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 litestar-org/sqlspec

Tutte le issue di litestar-org/sqlspec

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.