Replies: 5 comments 7 replies
-
seems it's not support |
Beta Was this translation helpful? Give feedback.
-
See my reply here: #729 (reply in thread) |
Beta Was this translation helpful? Give feedback.
-
Also cannot figure this out. Was looking for a workaround for a deficiency of Relationship fields, but without this the pydantic model and the sa model need to remain broken apart. It would be very nice to have this added as a feature, or at least more clearly documented. |
Beta Was this translation helpful? Give feedback.
-
It's not entirely clear what you want to get as a result. In your example, the |
Beta Was this translation helpful? Give feedback.
-
I hope it's ok if I follow up on this. I'm interested in SQLModel, namely as I'm learning FastAPI, but one thing that isn't clear/a feature I'd love is the ability to mark a field in the model as not part of the table. I did see above the explained mechanism of using inheritance to differentiate models, but that feels like overkill if all we're doing is having fields that may be used in code, but aren't saved to the database, or a constant. In these cases, it wouldn't be Pythonic to add preceding underscores, and in the case of a constant, it'd be all uppercase. In SQLAlchemy, we just wouldn't annotate it with |
Beta Was this translation helpful? Give feedback.
-
First Check
Commit to Help
Example Code
I also tried https://sqlmodel.tiangolo.com/tutorial/fastapi/multiple-models/#multiple-models-with-inheritance
Description
I'd like to retrieve data from a database and provide additional fields to the user. How can I achieve this?
thank you.
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.14
Python Version
3.11.6
Additional Context
And I tried PrivateAttr as well, but that doesn't serialize either.
Beta Was this translation helpful? Give feedback.
All reactions