json-type tutorial teaches client-side filtering as a property of JSON
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- jupyter-notebook, python
调研方向
This work is in src/tutorials/advanced/json-type.ipynb and is blocked on datajoint/datajoint-python#1564. After that issue merges, read the filtering reference added in #291, then update the “Filtering on JSON Content” section and Design Guidelines table. Re-execute the notebook so its committed outputs match, and cross-link the reference.
由索引模型根据 Issue 内容生成。
描述
Blocked on datajoint/datajoint-python#1564. Deliberately deferred so the tutorial is not rewritten twice.
The problem
src/tutorials/advanced/json-type.ipynb is the page a user opens to learn how to work with JSON. Its filtering section reads:
Filtering on JSON Content
Fetch then filter in Python:
followed by pulling the whole table into a list comprehension:
calibrated = [
e for e in Equipment.to_dicts()
if e['specs'] and e['specs'].get('calibrated')
]
and its Design Guidelines table lists this as an inherent property of the type:
| JSON | Normalized Tables |
|---|---|
| Filter in Python | Filter in SQL |
Why it is wrong
Server-side filtering works, on both backends. Equipment & {"specs.vendor": "Acme"} is translated to json_value() on MySQL and jsonb_extract_path_text() on PostgreSQL; ordering comparisons work through a typed projection, proj(ch="specs.channels:unsigned") & "ch > 32". The syntax is documented in #291.
So the tutorial teaches a full table scan into Python for something the database does, and presents it as a limitation of JSON rather than a choice.
Why it probably says that
The tutorial's own example is specs.calibrated, a boolean — and & {"specs.calibrated": True} returns no rows on MySQL and raises on PostgreSQL (datajoint-python#1564). Whoever wrote the section likely tried exactly that, got nothing back, and concluded JSON cannot be filtered server-side.
That is why this waits: writing the section against the string workaround ({"specs.calibrated": "true"}) would teach an idiom that becomes wrong as soon as #1564 lands.
When #1564 merges
- Rewrite Filtering on JSON Content to filter server-side, keeping one short client-side example for genuinely non-SQL-expressible predicates.
- Correct the Design Guidelines table — "Filter in Python" is not a property of JSON. The honest contrast is about indexing and type enforcement, not about where filtering happens.
- Cross-link the reference section added in #291.
- Re-execute the notebook: these are code cells with committed outputs.
- 主要语言
- Jupyter Notebook
- 星标
- 7
- 派生
- 12
- 平均合并
- 2 天 19 小时
- 30 天内合并 PR
- 20
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
datajoint/datajoint-docs 的其他 Issue
-
documentation
难度 3/5 1-2 天 新手友好度 45/100
datajoint/datajoint-docs#301 ·
维护者通常 3 天内回复
-
难度 3/5 半天 新手友好度 55/100
datajoint/datajoint-docs#300 ·
维护者通常 3 天内回复
-
难度 3/5 半天 新手友好度 52/100
datajoint/datajoint-docs#299 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 3/5 1-2 天 新手友好度 55/100
datajoint/datajoint-docs#298 ·
维护者通常 3 天内回复
查看 datajoint/datajoint-docs 的全部 Issue
相似的 Issue
-
documentation
难度 1/5 1 小时以内 新手友好度 86/100
bridgetownrb/bridgetown#1130 ·
-
Add TOC to repo未关闭
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 66/100
netlify/netlify-mcp#75 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 91/100
twbs/bootstrap#43050 · 1 条评论 ·
维护者通常 1 天内回复
-
agent-butler-finding chore
难度 2/5 1-3 小时 新手友好度 78/100
jordansmall/spindrift#5128 ·
维护者通常 1 天内回复