Provide a "class" row factory
还没有人认领这个 Issue。
- #57 来自 @ms2892 —— 已关闭,未合并
评估
调研方向
首先在仓库中找到现有的 dict 和 namedtuple 行工厂,然后将它们的接口与 psycopg 的 class_row 文档进行比较。此次更改应支持将客户端定义的 dataclasses 和 pydantic 模型作为行结果,并提供与链接示例类似的静态类型检查。查看已关闭的 pull request #57,了解之前实现的背景和预期行为。
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
Currently, comdb2 module provides dict and namedtuple factories. It would also be nice to provide a "class" row factory which would allow rows returned as client-defined dataclasses, pydantic models, etc.
Describe the solution you'd like
See a similar concept in psycopg's class_row factory: https://www.psycopg.org/psycopg3/docs/api/rows.html#psycopg.rows.class_row
This also allows nice static type checking: https://www.psycopg.org/psycopg3/docs/advanced/typing.html#example-returning-records-as-pydantic-models
- 主要语言
- Python
- 星标
- 29
- 派生
- 28
- 平均合并
- 11 小时 25 分钟
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bloomberg/python-comdb2 的其他 Issue
-
enhancement
难度 5/5 一周以上 新手友好度 25/100
bloomberg/python-comdb2#61 ·
-
难度 4/5 3-5 天 新手友好度 20/100
bloomberg/python-comdb2#60 ·
-
难度 2/5 1-3 小时 新手友好度 35/100
bloomberg/python-comdb2#41 ·
-
难度 4/5 3-5 天 新手友好度 35/100
bloomberg/python-comdb2#36 · 1 条评论 ·
查看 bloomberg/python-comdb2 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/skills#1811 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·