class AttributeState(object):
Provide an inspection interface corresponding to a particular attribute on a particular mapped object.
The .AttributeState
object is accessed
via the .InstanceState.attrs
collection
of a particular .InstanceState
:
from sqlalchemy import inspect insp = inspect(some_mapped_object) attr_state = insp.attrs.some_attribute
Method | __init__ |
Undocumented |
Method | load​_history |
Return the current pre-flush change history for this attribute, via the .History interface. |
Instance Variable | key |
Undocumented |
Instance Variable | state |
Undocumented |
Property | history |
Return the current pre-flush change history for this attribute, via the .History interface. |
Property | loaded​_value |
The current value of this attribute as loaded from the database. |
Property | value |
Return the value of this attribute. |
Return the current pre-flush change history for
this attribute, via the .History
interface.
This method will emit loader callables if the value of the attribute is unloaded.
Note
The attribute history system tracks changes on a per flush
basis. Each time the .Session
is flushed, the history
of each attribute is reset to empty. The .Session
by
default autoflushes each time a _query.Query
is invoked.
For
options on how to control this, see :ref:`session_flushing`.
See Also
.AttributeState.history
.attributes.get_history
- underlying function
Return the current pre-flush change history for
this attribute, via the .History
interface.
This method will not emit loader callables if the value of the attribute is unloaded.
Note
The attribute history system tracks changes on a per flush
basis. Each time the .Session
is flushed, the history
of each attribute is reset to empty. The .Session
by
default autoflushes each time a _query.Query
is invoked.
For
options on how to control this, see :ref:`session_flushing`.
See Also
.AttributeState.load_history
- retrieve history
using loader callables if the value is not locally present.
.attributes.get_history
- underlying function