Consider Removing New Line Characters when Comparing Computed Constructs
还没有人认领这个 Issue。
评估
调研方向
从 alembic/autogenerate/compare.py 的第 1047-1055 行附近开始,这里会在比较前清理数据库和本地的计算子句。使用 PostgreSQL 上的多行 Computed Column 重现该问题,然后验证换行位置不同但等价的子句不再产生 computed-default warning。
由索引模型根据 Issue 内容生成。
描述
I'm working with a Computed Column construct, which is really long and therefore contains line breaks for readability.
When this construct gets imported into the underlying database (Postgres in my case), the construct gets reformatted with line breaks inserted in different places.
This creates a small side-effect, where alembic now thinks that the original computed clause provided by the migration file is different to the one in the database, and therefore emits a warning.
/usr/local/lib/python3.10/site-packages/alembic/autogenerate/compare.py:1090:
UserWarning: Computed default on *** cannot be modified
util.warn("Computed default on %s.%s cannot be modified" % (tname, cname))
After inspecting the code, I found this method, which appears to sanitize the database computed clause as well as the local one:
I feel that we should include line breaks in the list of tokens that should be removed before a comparison takes place, but happy to hear what thoughts you have on this.
Thanks!
- 主要语言
- Python
- 星标
- 4.5k
- 派生
- 391
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sqlalchemy/alembic 的其他 Issue
-
on_version_apply is typed as a positional callable, but alembic calls it with keyword arguments可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
sqlalchemy/alembic#1883 · 1 条评论 ·
-
Revision message is rendered unescaped into the migration docstring; triple quotes and backslashes break the generated script可能重新可做 @ApparentlyTejas 于 21 天前认领,目前没有进行中的 PR。 未关闭bug command interface
难度 2/5 1-3 小时 新手友好度 70/100
sqlalchemy/alembic#1879 · 3 条评论 ·
-
bug pep 484
难度 2/5 1-3 小时 新手友好度 74/100
sqlalchemy/alembic#1341 · 2 条评论 ·
-
Identity and Computed comparison skipped when compare_server_default is not set, as of 1.18.0可能重新可做 关联的 PR 已关闭且未合并。 未关闭autogenerate - defaults bug regression
难度 3/5 1-2 天 新手友好度 50/100
sqlalchemy/alembic#1877 · 1 条评论 ·
-
Entry point for DefaultImpl subclasses? (or, just use plugins?)可能已有人在做 @dwreeves 于 40 天前认领。 未关闭code review in progress migration environment use case
难度 5/5 一周以上 新手友好度 25/100
sqlalchemy/alembic#1874 · 1 条评论 ·
查看 sqlalchemy/alembic 的全部 Issue
相似的 Issue
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL ports可能已有人在做 @himanchalkaushale 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
OWASP/Nettacker#1884 · 1 条评论 ·
维护者通常 1 天内回复
-
A-connection-core C-enhancement
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
aws-samples/sample-per-model-bedrock#869 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 82/100
fzn0x/watchtower#17 ·