How to inherit Class with ‘sa_column’ in a proper way? #906
Unanswered
zhu-lingfeng
asked this question in
Questions
Replies: 3 comments 2 replies
-
You are right there is a strange behaviour here but what you can actually do is to use This should work as expected: class ReportItemBase(SQLModel):
...
full_content: Optional[dict] = Field(None, sa_type=JSON) |
Beta Was this translation helpful? Give feedback.
0 replies
-
邮件已收到,我会尽快回复~【自动回复】
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I am facing a similar problem but I use the onupdate attr from Column.
I get this error sqlalchemy.exc.ArgumentError: Column object 'updated_at' already assigned to Table 'user'. Is there a solution to this? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
When I run fastapi, i get an error "sqlalchemy.exc.ArgumentError: Column object 'full_content' already assigned to Table 'reportitem_json'".
I've read SQLAlchemy's doc Mapping Class Inheritance Hierarchies and still have no idea.
Why this happen and what should i do to fix it?
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.16
Python Version
3.10.12
Additional Context
SQLAlchemy 2.0.29
Beta Was this translation helpful? Give feedback.
All reactions