diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-02-09 12:22:39 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-02-09 12:22:39 -0500 |
commit | 833583458c69e24e797c300c934da0ff04348db5 (patch) | |
tree | ac8be1f8cdcba0757f75973b6af9d0daf4120389 /lib/sqlalchemy/orm/attributes.py | |
parent | fcb5dbf39569bcacb70a3fed05f469d73b64f116 (diff) | |
download | sqlalchemy-833583458c69e24e797c300c934da0ff04348db5.tar.gz |
Note for history methods that history is reset per-flush.
Change-Id: I9bc4d0ddfa93f13e6717b89fa9934f1b8052147f
Diffstat (limited to 'lib/sqlalchemy/orm/attributes.py')
-rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 879b88a92..1b8c8c7f3 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -1724,6 +1724,17 @@ def get_history(obj, key, passive=PASSIVE_OFF): """Return a :class:`.History` record for the given object and attribute key. + This is the **pre-flush** history for a given attribute, which is + reset each time the :class:`.Session` flushes changes to the + current database transaction. + + .. note:: + + Prefer to use the :attr:`.AttributeState.history` and + :meth:`.AttributeState.load_history` accessors to retrieve the + :class:`.History` for instance attributes. + + :param obj: an object whose class is instrumented by the attributes package. @@ -1735,6 +1746,13 @@ def get_history(obj, key, passive=PASSIVE_OFF): :attr:`.PASSIVE_OFF` indicating all necessary SQL should be emitted. + .. seealso:: + + :attr:`.AttributeState.history` + + :meth:`.AttributeState.load_history` - retrieve history + using loader callables if the value is not locally present. + """ if passive is True: util.warn_deprecated( |