Skip to content

Commit

Permalink
Merge pull request #173 from feluelle/fix/update-missing-commit
Browse files Browse the repository at this point in the history
Add missing commit to update
  • Loading branch information
igorbenav authored Oct 20, 2024
2 parents 1070499 + 38a5a76 commit f3017e9
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 f3017e9

Please sign in to comment.