-
Notifications
You must be signed in to change notification settings - Fork 26
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 nested model created with create_pydantic_model
#76
Comments
@dantownsend This is cool, I just have a question, should |
@aminalaee Yeah, it's a good point. I think it would just return a single model still. The child models would just be created internally by It's a bit ugly, but you could still access the sub models if you wanted them. class Manager(Table):
name = Varchar()
class Band(Table):
name = Varchar()
manager = ForeignKey(Manager)
BandModel = create_pydantic_model(Band, nested=True)
BandModel.__fields__['manager'].type_
>>> ManagerModel What do you think? |
@dantownsend I have to say I like |
@aminalaee Great, thanks |
As suggested here:
piccolo-orm/piccolo#202
It would be great if
create_pydantic_model
could generate nested models.This would output something equivalent to this:
The text was updated successfully, but these errors were encountered: