class documentation

class AttributeState(object):

View In Hierarchy

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.
def __init__(self, state, key):

Undocumented

def load_history(self):

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

New in version 0.9.0.
key =

Undocumented

state =

Undocumented

@property
history =

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

@property
loaded_value =

The current value of this attribute as loaded from the database.

If the value has not been loaded, or is otherwise not present in the object's dictionary, returns NO_VALUE.

@property
value =

Return the value of this attribute.

This operation is equivalent to accessing the object's attribute directly or via getattr(), and will fire off any pending loader callables if needed.