A single setting to disable all schema changes (DDL) at run time, Lookup contents included
维护者通常 6 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 15/100
调研方向
Start with schemas.py around lines 329-340 (Lookup contents insertion) and Schema.call / _decorate_table, then autopopulate.py lines 186-187 and jobs.py lines 383-384, where jobs tables are declared. The open design question is where a single allow_ddl check should sit, and whether it must cover alter() and drop(). Done means that with the setting false, each of these paths raises a clear error naming the setting, and an explicit declare_all() path exists for deployments.
由索引模型根据 Issue 内容生成。
描述
What the library does today
Schema changes happen implicitly whenever a process activates a schema with a privileged login:
- Activating a schema declares every table that doesn't exist yet (
Schema.__call__→_decorate_table, whencreate_tablesis true, the default). - Declaring a Lookup table inserts any
contentsrows that are missing (schemas.py:329–340). populate()andjobs.refresh()declare a table's~~jobstable on first use (autopopulate.py:186–187,jobs.py:383–384), even whencreate_tablesis false.alter()anddrop()run whenever they're called.
So setting create_tables=False, as the production guide advises, still leaves schema changes at run time, through the jobs tables and Lookup contents. Nothing turns them all off at once.
Proposal
A single setting, for example database.allow_ddl (env DJ_ALLOW_DDL), default true. With it set to false, nothing changes the schema:
- no table, part or jobs-table declaration;
- no Lookup
contentsinserted, updated or deleted; - no
alter(),drop()or schema creation.
An attempt raises a clear error naming the setting, rather than silently doing nothing. A missing table is reported as missing, not declared, and populate() and refresh() fail clearly if a jobs table doesn't exist.
Why
In a controlled deployment, schema changes are a deployment step: planned, reviewed and applied together, before the new code runs. Run-time processes (workers, notebooks, dashboards) then read and write rows but never change the schema. This setting lets an operator enforce that in the library, not only through database privileges.
Also needed
An explicit way for the deployment step to apply schema changes (declare missing tables, their jobs tables and Lookup contents) with the setting on, e.g. a schema.declare_all(), or the setting being overridable for one call.
Expected behavior
With allow_ddl=false, a pipeline whose tables all exist runs as before; one with a missing table, a missing jobs table or changed Lookup contents fails at activation or populate, with a message that says what's missing.
Related
#1552 proposes declaring draft tables on the server beside the pipeline's tables. With schema changes treated as a deployment step, should drafting stay entirely in memory instead?
- 主要语言
- Python
- 星标
- 198
- 派生
- 103
- 平均合并
- 6 天 1 小时
- 30 天内合并 PR
- 10
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
datajoint/datajoint-python 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
datajoint/datajoint-python#1703 ·
维护者通常 6 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
datajoint/datajoint-python#1702 ·
维护者通常 6 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
datajoint/datajoint-python#1701 ·
维护者通常 6 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
datajoint/datajoint-python#1691 ·
维护者通常 6 天内回复
-
dependencies needs-discussion
难度 2/5 1-3 小时 新手友好度 68/100
datajoint/datajoint-python#1687 ·
维护者通常 6 天内回复
查看 datajoint/datajoint-python 的全部 Issue
相似的 Issue
-
needs-triage
难度 1/5 1-3 小时 新手友好度 85/100
gke-labs/kube-agents#6620 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
open-webui/open-webui#34719 · 2 条评论 ·
维护者通常 1 天内回复
-
cognition
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
One non-object JSON record makes the session catalog exit可能已有人在做 @he-yufeng 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
collabnix/awesome-mcp-lists#433 ·
维护者通常 4 天内回复