Provide a "class" row factory
Nobody has claimed this yet.
- #57 by @ms2892 — closed without merging
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start by locating the existing dict and namedtuple row factories in the repository, then compare their interfaces with psycopg's class_row documentation. The change should support client-defined dataclasses and pydantic models as row results, with static typing similar to the linked example. Check closed pull request #57 for prior implementation context and expected behavior.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Python
- Stars
- 29
- Forks
- 28
- Avg merge
- 11h 25m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bloomberg/python-comdb2
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
bloomberg/python-comdb2#80 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
bloomberg/python-comdb2#61 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
bloomberg/python-comdb2#60 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
bloomberg/python-comdb2#41 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
bloomberg/python-comdb2#36 · 1 comment ·
All issues in bloomberg/python-comdb2
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·