class documentation

class DedupeColumnCollection(ColumnCollection):

View In Hierarchy

A _expression.ColumnCollection that maintains deduplicating behavior.

This is useful by schema level objects such as _schema.Table and .PrimaryKeyConstraint. The collection includes more sophisticated mutator methods as well to suit schema objects which require mutable column collections.

New in version 1.4.
Method ​_populate​_separate​_keys populate from an iterator of (key, column)
Method add Add a column to this _sql.ColumnCollection.
Method extend Undocumented
Method remove Dictionary remove() is not implemented for _sql.ColumnCollection.
Method replace add the given column to this collection, removing unaliased versions of this column as well as existing columns with the same key.

Inherited from ColumnCollection:

Method as​_immutable Return an "immutable" form of this _sql.ColumnCollection.
Method clear Dictionary clear() is not implemented for _sql.ColumnCollection.
Method compare Compare this _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 No summary
Method get Get a _sql.ColumnClause or _schema.Column object based on a string key name from this _expression.ColumnCollection.
Method items No summary
Method keys Return a sequence of string key names for all columns in this collection.
Method update Dictionary update() is not implemented for _sql.ColumnCollection.
Method values Return a sequence of _sql.ColumnClause or _schema.Column objects for all columns in this collection.
Method __bool__ 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 ​_initial​_populate Undocumented
Class Variable __hash__ Undocumented
Class Variable __slots__ Undocumented
Property ​_all​_columns Undocumented
def _populate_separate_keys(self, iter_):
populate from an iterator of (key, column)
def add(self, column, key=None):

Add a column to this _sql.ColumnCollection.

Note

This method is not normally used by user-facing code, as the _sql.ColumnCollection is usually part of an existing object such as a _schema.Table. To add a _schema.Column to an existing _schema.Table object, use the _schema.Table.append_column method.

def extend(self, iter_):

Undocumented

def remove(self, column):
Dictionary remove() is not implemented for _sql.ColumnCollection.
def replace(self, column):

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.