]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Added a tweak to the "history_meta" example where the check for
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 3 Feb 2014 00:05:36 +0000 (19:05 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 3 Feb 2014 00:05:36 +0000 (19:05 -0500)
"history" on a relationship-bound attribute will now no longer emit
any SQL if the relationship is unloaded.

doc/build/changelog/changelog_09.rst
examples/versioned_history/history_meta.py

index 992ace2ea27c0839bbe3c01c38b568bccbefe4e2..a043d61c344308375acbc6cc1959d7ea563000cd 100644 (file)
 .. changelog::
     :version: 0.9.2
 
+    .. change::
+        :tags: bug, examples
+
+        Added a tweak to the "history_meta" example where the check for
+        "history" on a relationship-bound attribute will now no longer emit
+        any SQL if the relationship is unloaded.
+
     .. change::
         :tags: feature, sql
 
index 8cb52343434800c7749eb34a4d54d83ce2da5f4d..04cb4e1aabff16da33893c9396c45017f245bd94 100644 (file)
@@ -160,7 +160,8 @@ def create_version(obj, session, deleted = False):
         # check those too
         for prop in obj_mapper.iterate_properties:
             if isinstance(prop, RelationshipProperty) and \
-                attributes.get_history(obj, prop.key).has_changes():
+                attributes.get_history(obj, prop.key,
+                        passive=attributes.PASSIVE_NO_INITIALIZE).has_changes():
                 for p in prop.local_columns:
                     if p.foreign_keys:
                         obj_changed = True