Replies: 3 comments
-
Duplicate of #214 |
Beta Was this translation helpful? Give feedback.
-
@Mahi yeah, except that SQLAlchemy models could have private data like hashed passwords. And Pydantic models wouldn't. Also, input Pydantic models would probably have data that is not stored in the DB, like a password. But still, this is probably a good idea for a third-party package. It wouldn't make sense to have it as part of FastAPI, as FastAPI is independent of ORM. And it wouldn't make sense to have it as part of Pydantic for the same reason. But it would definitely be great (at least for some use cases) to have a third-party package that is based on Pydantic and generates SQLAlchemy models from them. @timothycrosley here's an example of this idea that we discussed recently 😄 And I'm pretty sure it's not the first time it pops up... |
Beta Was this translation helpful? Give feedback.
-
Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues. |
Beta Was this translation helpful? Give feedback.
-
Following the SQL (Relational) Databases tutorial, it seems one has to define Pydantic and SQLAlchemy models separately:
As the number of models grows, this leads to large amounts of duplicate code and attributes. Is there a way to merge these two classes into one, or are there any plans on adding such functionality?
Beta Was this translation helpful? Give feedback.
All reactions