- changed milestone to 1.0
- changed component to orm
- changed title to query update()/delete() pass to session.execute() without mapper
query update()/delete() pass to session.execute() without mapper
Issue #3242
resolved
Maybe not strictly a bug but it led to very buggy/unexpected results.
When query is getting connection it passes a mapper:
conn = self._connection_from_session(
mapper=self._mapper_zero_or_none(),
clause=querycontext.statement,
close_with_result=True)
But delete (BulkDelete) does not:
self.result = self.query.session.execute(delete_stmt,
params=self.query._params)
We have a table that is not in binds list (session.__binds), so for the same table query works (because of mapper) but delete not and it was very hard to figure out what is the difference. It would be much better if delete used the same mechanism as query.
Comments (2)
-
repo owner -
repo owner - changed status to resolved
- The primary :class:
.Mapper
of a :class:.Query
is now passed to the :meth:.Session.get_bind
method when calling upon :meth:.Query.count
, :meth:.Query.update
, :meth:.Query.delete
, as well as queries against mapped columns, :obj:.column_property
objects, and SQL functions and expressions derived from mapped columns. This allows sessions that rely upon either customized :meth:.Session.get_bind
schemes or "bound" metadata to work in all relevant cases. fixes#3227fixes#3242fixes#1326
→ <<cset 611883ffb35c>>
- Log in to comment