MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / append

Method append

lib/sqlalchemy/orm/attributes.py:1882–1904  ·  view source on GitHub ↗
(
        self,
        state: InstanceState[Any],
        dict_: _InstanceDict,
        value: Any,
        initiator: Optional[AttributeEventToken],
        passive: PassiveFlag = PASSIVE_OFF,
    )

Source from the content-addressed store, hash-verified

1880 return adapter, collection
1881
1882 def append(
1883 self,
1884 state: InstanceState[Any],
1885 dict_: _InstanceDict,
1886 value: Any,
1887 initiator: Optional[AttributeEventToken],
1888 passive: PassiveFlag = PASSIVE_OFF,
1889 ) -> None:
1890 collection = self.get_collection(
1891 state, dict_, user_data=None, passive=passive
1892 )
1893 if collection is PASSIVE_NO_RESULT:
1894 value = self.fire_append_event(
1895 state, dict_, value, initiator, key=NO_KEY
1896 )
1897 assert (
1898 self.key not in dict_
1899 ), "Collection was loaded during event handling."
1900 state._get_pending_mutation(self.key).append(value)
1901 else:
1902 if TYPE_CHECKING:
1903 assert isinstance(collection, CollectionAdapter)
1904 collection.append_with_event(value, initiator)
1905
1906 def remove(
1907 self,

Callers

nothing calls this directly

Calls 5

get_collectionMethod · 0.95
fire_append_eventMethod · 0.95
_get_pending_mutationMethod · 0.80
append_with_eventMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected