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

Method _populate_separate_keys

lib/sqlalchemy/sql/base.py:1800–1812  ·  view source on GitHub ↗

populate from an iterator of (key, column)

(
        self, iter_: Iterable[Tuple[_COLKEY, _COL_co]]
    )

Source from the content-addressed store, hash-verified

1798 __hash__: Optional[int] = None # type: ignore
1799
1800 def _populate_separate_keys(
1801 self, iter_: Iterable[Tuple[_COLKEY, _COL_co]]
1802 ) -> None:
1803 """populate from an iterator of (key, column)"""
1804
1805 self._collection[:] = collection = [
1806 (k, c, _ColumnMetrics(self, c)) for k, c in iter_
1807 ]
1808 self._colset.update(c._deannotate() for _, c, _ in collection)
1809 self._index.update(
1810 {idx: (k, c) for idx, (k, c, _) in enumerate(collection)}
1811 )
1812 self._index.update({k: (k, col) for k, col, _ in reversed(collection)})
1813
1814 def add(
1815 self, column: ColumnElement[Any], key: Optional[_COLKEY] = None

Calls 3

_ColumnMetricsClass · 0.85
updateMethod · 0.45
_deannotateMethod · 0.45

Tested by

no test coverage detected