MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / get_history

Method get_history

lib/sqlalchemy/orm/attributes.py:1683–1706  ·  view source on GitHub ↗
(
        self,
        state: InstanceState[Any],
        dict_: _InstanceDict,
        passive: PassiveFlag = PASSIVE_OFF,
    )

Source from the content-addressed store, hash-verified

1681 return [y for y in collections.collection_adapter(item)]
1682
1683 def get_history(
1684 self,
1685 state: InstanceState[Any],
1686 dict_: _InstanceDict,
1687 passive: PassiveFlag = PASSIVE_OFF,
1688 ) -> History:
1689 current = self.get(state, dict_, passive=passive)
1690
1691 if current is PASSIVE_NO_RESULT:
1692 if (
1693 passive & PassiveFlag.INCLUDE_PENDING_MUTATIONS
1694 and self.key in state._pending_mutations
1695 ):
1696 pending = state._pending_mutations[self.key]
1697 return pending.merge_with_history(HISTORY_BLANK)
1698 else:
1699 return HISTORY_BLANK
1700 else:
1701 if passive & PassiveFlag.INCLUDE_PENDING_MUTATIONS:
1702 # this collection is loaded / present. should not be any
1703 # pending mutations
1704 assert self.key not in state._pending_mutations
1705
1706 return History.from_collection(self, state, current)
1707
1708 def get_all_pending(
1709 self,

Callers

nothing calls this directly

Calls 3

merge_with_historyMethod · 0.80
from_collectionMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected