Skip to content

Commit

Permalink
Add missing commit to update
Browse files Browse the repository at this point in the history
  • Loading branch information
feluelle committed Oct 18, 2024
1 parent 1070499 commit 38a5a76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fastcrud/crud/fast_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -2222,6 +2222,8 @@ async def update(
if return_columns:
stmt = stmt.returning(*[column(name) for name in return_columns])
db_row = await db.execute(stmt)
if commit:
await db.commit()
if allow_multiple:
return self._as_multi_response(
db_row,
Expand Down
4 changes: 4 additions & 0 deletions tests/sqlalchemy/crud/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,7 @@ async def test_update_with_returning(
)

assert updated_record == expected_result

# Rollback the current transaction to see if the record was actually committed
await async_session.rollback()
assert await crud.count(async_session, name="Updated Name") == 1

0 comments on commit 38a5a76

Please sign in to comment.