Replies: 1 comment
-
Hey there, did you try to set the data on class Cluster(SQLModel, table=True):
id: str = Field(primary_key=True, max_length=50, sa_type=String(50))
vcenterid: int
name: str = Field(max_length=80, sa_type=String(80), nullable=False)
fk_id: Optional[str] = Field(
default=None,
sa_column=Column(
String(60),
server_default="CONVERT([nvarchar](60),concat([vcenterid],'_',[id]))",
persisted=True,
nullable=False
)
) I did not test the code but feel free to come back asking if anything is not working ;-) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
i can't find a way to declare using sqlmodel FK_ID field. the idea of this field is to calculate foreign key id using table fields
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.16
Python Version
3.8.10
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions