Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing commit to update #173

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading