()
| 2 | |
| 3 | |
| 4 | def test_sqlmodel_update(): |
| 5 | class Organization(SQLModel, table=True): |
| 6 | id: int = Field(default=None, primary_key=True) |
| 7 | name: str |
| 8 | headquarters: str |
| 9 | |
| 10 | class OrganizationUpdate(SQLModel): |
| 11 | name: str |
| 12 | |
| 13 | org = Organization(name="Example Org", city="New York", headquarters="NYC HQ") |
| 14 | org_in = OrganizationUpdate(name="Updated org") |
| 15 | org.sqlmodel_update( |
| 16 | org_in, |
| 17 | update={ |
| 18 | "headquarters": "-", # This field is in Organization, but not in OrganizationUpdate |
| 19 | }, |
| 20 | ) |
nothing calls this directly
no test coverage detected
searching dependent graphs…