class documentation

class DedupeColumnCollection(ColumnCollection[str, _NAMEDCOL]): (source)

View In Hierarchy

A :class:`_expression.ColumnCollection` that maintains deduplicating behavior. This is useful by schema level objects such as :class:`_schema.Table` and :class:`.PrimaryKeyConstraint`. The collection includes more sophisticated mutator methods as well to suit schema objects which require mutable column collections. .. versionadded:: 1.4

Method add Add a column to this :class:`_sql.ColumnCollection`.
Method extend Undocumented
Method remove Undocumented
Method replace add the given column to this collection, removing unaliased versions of this column as well as existing columns with the same key.
Method _populate_separate_keys populate from an iterator of (key, column)

Inherited from ColumnCollection:

Method __bool__ Undocumented
Method __clause_element__ Undocumented
Method __contains__ Undocumented
Method __delitem__ Undocumented
Method __eq__ Undocumented
Method __getattr__ Undocumented
Method __getitem__ Undocumented
Method __getstate__ Undocumented
Method __init__ Undocumented
Method __iter__ Undocumented
Method __len__ Undocumented
Method __setattr__ Undocumented
Method __setitem__ Undocumented
Method __setstate__ Undocumented
Method __str__ Undocumented
Method as_readonly Return a "read only" form of this :class:`_sql.ColumnCollection`.
Method clear Dictionary clear() is not implemented for :class:`_sql.ColumnCollection`.
Method compare Compare this :class:`_expression.ColumnCollection` to another based on the names of the keys
Method contains_column Checks if a column object exists in this collection
Method corresponding_column Given a :class:`_expression.ColumnElement`, return the exported :class:`_expression.ColumnElement` object from this :class:`_expression.ColumnCollection` which corresponds to that original :class:`_expression...
Method get Get a :class:`_sql.ColumnClause` or :class:`_schema.Column` object based on a string key name from this :class:`_expression.ColumnCollection`.
Method items Return a sequence of (key, column) tuples for all columns in this collection each consisting of a string key name and a :class:`_sql.ColumnClause` or :class:`_schema.Column` object.
Method keys Return a sequence of string key names for all columns in this collection.
Method update Dictionary update() is not implemented for :class:`_sql.ColumnCollection`.
Method values Return a sequence of :class:`_sql.ColumnClause` or :class:`_schema.Column` objects for all columns in this collection.
Class Variable __hash__ Undocumented
Class Variable __slots__ Undocumented
Method _init_proxy_index populate the "proxy index", if empty.
Method _initial_populate Undocumented
Class Variable _collection Undocumented
Class Variable _colset Undocumented
Class Variable _index Undocumented
Class Variable _proxy_index Undocumented
Property _all_columns Undocumented
def add(self, column: ColumnElement[Any], key: Optional[str] = None): (source)

Add a column to this :class:`_sql.ColumnCollection`. .. note:: This method is **not normally used by user-facing code**, as the :class:`_sql.ColumnCollection` is usually part of an existing object such as a :class:`_schema.Table`. To add a :class:`_schema.Column` to an existing :class:`_schema.Table` object, use the :meth:`_schema.Table.append_column` method.

def extend(self, iter_: Iterable[_NAMEDCOL]): (source)

Undocumented

def remove(self, column: _NAMEDCOL): (source)
def replace(self, column: _NAMEDCOL, extra_remove: Optional[Iterable[_NAMEDCOL]] = None): (source)

add the given column to this collection, removing unaliased versions of this column as well as existing columns with the same key. e.g.:: t = Table('sometable', metadata, Column('col1', Integer)) t.columns.replace(Column('col1', Integer, key='columnone')) will remove the original 'col1' from the collection, and add the new column under the name 'columnname'. Used by schema.Column to override columns during table reflection.

def _populate_separate_keys(self, iter_: Iterable[Tuple[str, _NAMEDCOL]]): (source)

populate from an iterator of (key, column)