- changed milestone to 0.5.xx
- assigned issue to
Query.delete does not work with a string filter
Issue #1242
resolved
Deleting objects using ORM query with a .filter('something') does not delete any rows.
A test program demonstrating the problem is attached.
Comments (6)
-
repo owner -
repo owner -
repo owner here's a patch if someone wants to create a unit test for us to test/orm/query UpdateDeleteTest, which tests both delete() and update()
Index: lib/sqlalchemy/orm/query.py =================================================================== --- lib/sqlalchemy/orm/query.py (revision 5459) +++ lib/sqlalchemy/orm/query.py (working copy) @@ -1371,11 +1371,11 @@ if synchronize_session == 'fetch': #TODO: use RETURNING when available select_stmt = context.statement.with_only_columns(primary_table.primary_key) - matched_rows = session.execute(select_stmt).fetchall() + matched_rows = session.execute(select_stmt, params=self._params).fetchall() if self._autoflush: session._autoflush() - result = session.execute(delete_stmt) + result = session.execute(delete_stmt, params=self._params) if synchronize_session == 'evaluate': target_cls = self._mapper_zero().class_ @@ -1456,11 +1456,11 @@ if synchronize_session == 'expire': select_stmt = context.statement.with_only_columns(primary_table.primary_key) - matched_rows = session.execute(select_stmt).fetchall() + matched_rows = session.execute(select_stmt, params=self._params).fetchall() if self._autoflush: session._autoflush() - result = session.execute(update_stmt) + result = session.execute(update_stmt, params=self._params) if synchronize_session == 'evaluate': target_cls = self._mapper_zero().class_
-
Corrected in 887c403f763fae9e0f6697b31a31e263174d06c9
-
repo owner - removed milestone
Removing milestone: 0.5.0 (automated comment)
-
repo owner - edited description
- removed responsible
- Log in to comment
ill try to get to this if ants does not first.