MCPcopy Index your code
hub / github.com/fastapi/sqlmodel / test_sqlmodel_update

Function test_sqlmodel_update

tests/test_update.py:4–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3
4def 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 )

Callers

nothing calls this directly

Calls 3

OrganizationClass · 0.85
OrganizationUpdateClass · 0.85
sqlmodel_updateMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…