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

Make exclude_columns work with nested for create_pydantic_model #80

Closed
dantownsend opened this issue Sep 2, 2021 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@dantownsend
Copy link
Member

We have two great new features for create_pydantic_model (exclude_columns and nested).

I'd like to make sure that they work together. For example:

create_pydantic_model(Band, nested=True, exclude_columns=(Band.manager.id,))

In which case the Manager sub model would omit it's id column.

@dantownsend dantownsend added the enhancement New feature or request label Sep 2, 2021
@sinisaos
Copy link
Member

@dantownsend Just for info. Excluding individual column from the sub model doesn't work ValueError raised from here because Band.manager.id is invalid Band table column. We can only exclude the entire sub model like this

create_pydantic_model(Band, nested=True, exclude_columns=(Band.manager,))

@dantownsend
Copy link
Member Author

@sinisaos Yeah, it's unfortunate. Not an urgent issue, but would be nice to have.

@sinisaos
Copy link
Member

@dantownsend Can you please close this issue because it's done with latest changes.

@dantownsend
Copy link
Member Author

@sinisaos Yep, good point. Fixed by #98

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

2 participants