Commit Graph

7 Commits

Author SHA1 Message Date
Mike Bayer 0997e843f2 - Internal calls to "bookkeeping" functions within
:meth:`.Session.bulk_save_objects` and related bulk methods have
been scaled back to the extent that this functionality is not
currently used, e.g. checks for column default values to be
fetched after an INSERT or UPDATE statement.
fixes #3526
2015-09-08 14:12:32 -04:00
Mike Bayer 68a6701c6d - Fixed bug in :meth:.Session.bulk_save_objects where a mapped
column that had some kind of "fetch on update" value and was not
locally present in the given object would cause an AttributeError
within the operation.
fixes #3525
2015-09-08 13:00:26 -04:00
Mike Bayer 2497d559dd - add changelog for #3451, with 09485d7331 fixes #3451
- also add a bulk_insert_mappings test
2015-06-13 20:15:17 -04:00
Patrick Hayes 09485d7331 Fix primary key behaviour in bulk_update
Suppose you have a model class with a primary key.

Base = declarative_base()
class User(Base):
  id = Column(BigInteger, primary_key=True)
  name = Column(String)

Previously, running
`bulk_update_mappings(User, {'id': 1, 'name': 'hello'})`
would emit the following:

```UPDATE users SET id=1, name='hello' WHERE id=1```

This is contrary to the stated behaviour, where primary keys are omitted
from the SET clause. Furthermore, this behaviour is harmful, as it
can cause the db engine to lock over-aggresively (at least in Postgres).

With this change, the emitted SQL is:

```UPDATE users SET name='hello' WHERE id=1```
2015-06-13 14:11:16 -04:00
Mike Bayer 07cc9e054a - add an option for bulk_save -> update to not do history 2014-12-07 20:36:01 -05:00
Mike Bayer c42b8f8eb8 - fix inheritance persistence
- start writing docs
2014-12-07 20:21:20 -05:00
Mike Bayer e257ca6c52 - initial tests for bulk 2014-12-07 19:08:16 -05:00