bug(migrations): quoted version_table renders invalid CREATE TABLE
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 84/100
调研方向
从 sqlspec/migrations/base.py 中的 BaseMigrationTracker._split_version_table 开始,然后检查 sqlspec/migrations/tracker.py 中的 _tracking_table_builder 和 SyncMigrationTracker 示例。使用带引号的 App.Tracker 输入和 postgres DDL 进行复现;完成标准是 CREATE TABLE 使用 "App"."Tracker" 且没有双重引号,并且 tracker 的其他语句使用同一张表。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Python
- 星标
- 102
- 派生
- 9
- 平均合并
- 16 小时 30 分钟
- 30 天内合并 PR
- 77
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
litestar-org/sqlspec 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 92/100
litestar-org/sqlspec#816 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 45/100
litestar-org/sqlspec#810 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
litestar-org/sqlspec#788 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 42/100
litestar-org/sqlspec#728 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 20/100
litestar-org/sqlspec#509 ·
维护者通常 1 天内回复
查看 litestar-org/sqlspec 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
spec-kitty/spec-kitty#5319 ·
维护者通常 1 天内回复
-
backend::vllm diffusion multimodal
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
openai/openai-agents-python#5229 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复