Skip to content

Commit

Permalink
Merge branch 'main' into feature/upsert-multi-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
igorbenav authored Oct 20, 2024
2 parents eb6b4cb + f3017e9 commit 35e7572
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 @@ -2228,6 +2228,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 35e7572

Please sign in to comment.