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

Support pydantic.BaseModel.Config.underscore_attrs_are_private #145

Open
joeriddles opened this issue Jun 25, 2021 · 2 comments
Open

Support pydantic.BaseModel.Config.underscore_attrs_are_private #145

joeriddles opened this issue Jun 25, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@joeriddles
Copy link
Contributor

Feature request

Support using the underscore_attrs_are_private config in models.

Context

I use pydantic's underscore_attrs_are_private feature to have field in my pydantic models that are are not public.

from odmantic import Model

class Example(Model)
    class Config:
        underscore_attrs_are_private = True

odmantic.config.py raises ValueError: 'Example': 'Config.underscore_attrs_are_private' is not supported

Solution

Be able to use <model>.Config.underscore_attrs_are_private without an error being raised.

Alternative solutions

None.

Additional context

None.

@joeriddles joeriddles added the enhancement New feature or request label Jun 25, 2021
@art049
Copy link
Owner

art049 commented Jul 5, 2021

Hi,
What kind of behavior would you expect from those attributes ?
Should they be persisted in the database ? or ignored ?
If you have also a concrete example it would help me to understand the need as well

@austin1howard
Copy link

I'd like to see this too. My expectation is that private attributes wouldn't be persisted in the DB at all. In my use case, this would make sense as we have objects that persist and may be read, but those objects also have transient/runtime attributes which don't need to be saved/read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants