unused systems in bulk

Issue #3526 resolved
Mike Bayer repo owner created an issue

based on things found via #3525, _postfetch is called in bulk update for unknown reasons, as no tests fail removing it. need to isolate why _postfetch is needed and add tests, or not:

diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py
index c785a4d..6487228 100644
--- a/lib/sqlalchemy/orm/persistence.py
+++ b/lib/sqlalchemy/orm/persistence.py
@@ -672,6 +672,8 @@ def _emit_update_statements(base_mapper, uowtransaction,
                         connection, value_params in records:
                     c = cached_connections[connection].\
                         execute(statement, params)
+
+                    # TODO: why with bookkeeping=False?
                     _postfetch(
                         mapper,
                         uowtransaction,
@@ -694,6 +696,8 @@ def _emit_update_statements(base_mapper, uowtransaction,
                     execute(statement, multiparams)

                 rows += c.rowcount
+
+                # TODO: why with bookkeeping=False?
                 for state, state_dict, params, mapper, \
                         connection, value_params in records:
                     _postfetch(
@@ -964,6 +968,8 @@ def _postfetch(mapper, uowtransaction, table,
     after an INSERT or UPDATE statement has proceeded for that
     state."""

+    # TODO: bulk is never non-False, need to clean this up
+
     prefetch_cols = result.context.compiled.prefetch
     postfetch_cols = result.context.compiled.postfetch
     returning_cols = result.context.compiled.returning

Comments (1)

  1. Mike Bayer reporter
    • 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

    → <<cset 0997e843f2cd>>

  2. Log in to comment