Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Provide a "class" row factory

Open
#42 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #57 by @ms2892 — closed without merging

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
databases

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bloomberg/python-comdb2

All issues in bloomberg/python-comdb2

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.