This commit is contained in:
Timothy Jaeryang Baek
2025-11-21 01:48:06 -05:00
parent 41701697ec
commit 27b8775032
2 changed files with 4 additions and 6 deletions
+3 -5
View File
@@ -244,11 +244,9 @@ class ModelsTable:
try:
with get_db() as db:
# update only the fields that are present in the model
result = (
db.query(Model)
.filter_by(id=id)
.update(model.model_dump(exclude={"id"}))
)
data = model.model_dump(exclude={"id"})
result = db.query(Model).filter_by(id=id).update(data)
db.commit()
model = db.get(Model, id)