Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document interaction with dataclasses #407

Open
telenieko opened this issue Feb 24, 2025 · 1 comment
Open

Document interaction with dataclasses #407

telenieko opened this issue Feb 24, 2025 · 1 comment

Comments

@telenieko
Copy link

Hi,

One would intuitively think that dataclasses are a perfect match for ZODB:

  • They are in Python's standard library,
  • Let you define & enforce object schema (attributes, types)

But, 6 years after dataclasses where introduced (Python 3.7) I can find no resources on how they interact with ZODB. Or wether they are usable at all.

The most I found is related to python-attrs (i.e: #378 there).

It would probably be useful to have some insights on how modern Python dataclasses and ZODB interact and how both could be used together (if that is even possible).

@icemac
Copy link
Member

icemac commented Feb 25, 2025

You can store objects in ZODB wich are not augmented by persistence. But this way they will not get automatically updated in ZODB (at commit time) when chaning their attribute values.

It seems dataclasses are not widely used in context with ZODB – so some experimentation would be helpful.

So you are invited to do this experimentation and report back your findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants