class Column(DialectKWArgs, SchemaItem, ColumnClause):
Method | __init__ |
Construct a new Column object. |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | _copy |
Create a copy of this Column, uninitialized. |
Method | _extra_kwargs |
Undocumented |
Method | _make_proxy |
Create a proxy for this column. |
Method | _on_table_attach |
Undocumented |
Method | _set_parent |
Associate with this SchemaEvent's parent object. |
Method | _setup_on_memoized_fks |
Undocumented |
Method | append_foreign_key |
Undocumented |
Method | copy |
Undocumented |
Method | references |
Return True if this Column references the given column via foreign key. |
Class Variable | __visit_name__ |
Undocumented |
Class Variable | inherit_cache |
Indicate if this .HasCacheKey instance should make use of the cache key generation scheme used by its immediate superclass. |
Instance Variable | _proxies |
Undocumented |
Instance Variable | _user_defined_nullable |
Undocumented |
Instance Variable | autoincrement |
Undocumented |
Instance Variable | comment |
Undocumented |
Instance Variable | computed |
Undocumented |
Instance Variable | constraints |
Undocumented |
Instance Variable | default |
Undocumented |
Instance Variable | doc |
Undocumented |
Instance Variable | foreign_keys |
A collection of all _schema.ForeignKey marker objects associated with this _schema.Column . |
Instance Variable | identity |
Undocumented |
Instance Variable | index |
The value of the :paramref:`_schema.Column.index` parameter. |
Instance Variable | info |
Info dictionary associated with the object, allowing user-defined data to be associated with this .SchemaItem . |
Instance Variable | key |
The 'key' that in some circumstances refers to this object in a Python namespace. |
Instance Variable | nullable |
Undocumented |
Instance Variable | onupdate |
Undocumented |
Instance Variable | primary_key |
Undocumented |
Instance Variable | server_default |
Undocumented |
Instance Variable | server_onupdate |
Undocumented |
Instance Variable | system |
Undocumented |
Instance Variable | table |
Undocumented |
Instance Variable | unique |
The value of the :paramref:`_schema.Column.unique` parameter. |
Inherited from DialectKWArgs
:
Class Method | argument_for |
Add a new kind of dialect-specific keyword argument for this class. |
Method | _kw_reg_for_dialect_cls |
Undocumented |
Method | _validate_dialect_kwargs |
Undocumented |
Class Variable | _dialect_kwargs_traverse_internals |
Undocumented |
Class Variable | _kw_registry |
Undocumented |
Property | dialect_kwargs |
A collection of keyword arguments specified as dialect-specific options to this construct. |
Property | dialect_options |
A collection of keyword arguments specified as dialect-specific options to this construct. |
Property | kwargs |
A synonym for .DialectKWArgs.dialect_kwargs . |
Inherited from SchemaItem
:
Method | _init_items |
Initialize the list of child items for this SchemaItem. |
Method | _schema_item_copy |
Undocumented |
Class Variable | _use_schema_map |
Undocumented |
Class Variable | create_drop_stringify_dialect |
Undocumented |
Inherited from SchemaEventTarget
(via SchemaItem
):
Method | _set_parent_with_dispatch |
Undocumented |
Inherited from Traversible
(via SchemaItem
):
Method | get_children |
Return immediate child .visitors.Traversible elements of this .visitors.Traversible . |
Method | __class_getitem__ |
Undocumented |
Inherited from ColumnClause
:
Method | _clone |
Create a shallow copy of this ClauseElement. |
Method | _compare_name_for_result |
Return True if the given column element compares to this one when targeting within a result row. |
Method | _from_objects |
Undocumented |
Method | _gen_tq_label |
generate table-qualified label |
Method | _render_label_in_columns_clause |
No summary |
Method | get_children |
Return immediate child .visitors.Traversible elements of this .visitors.Traversible . |
Class Variable | _is_multiparam_column |
Undocumented |
Class Variable | _traverse_internals |
Undocumented |
Instance Variable | is_literal |
Undocumented |
Instance Variable | name |
Undocumented |
Instance Variable | type |
Undocumented |
Property | _ddl_label |
Undocumented |
Property | entity_namespace |
Undocumented |
Inherited from DDLReferredColumnRole
(via ColumnClause
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, DDLReferredColumnRole
, DDLConstraintColumnRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from ExpressionElementRole
(via ColumnClause
, LabeledColumnExprRole
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, LabeledColumnExprRole
, ExpressionElementRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from StrAsPlainColumnRole
(via ColumnClause
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, StrAsPlainColumnRole
, ColumnArgumentRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from Immutable
(via ColumnClause
):
Method | _copy_internals |
Undocumented |
Method | params |
Undocumented |
Method | unique_params |
Undocumented |
Class Variable | _is_immutable |
Undocumented |
Inherited from NamedColumn
(via ColumnClause
):
Method | _bind_param |
Undocumented |
Method | _non_anon_label |
the 'name' that naturally applies this element when rendered in SQL. |
Method | _tq_key_label |
table qualified label based on column key. |
Method | _tq_label |
table qualified label based on column name. |
Property | description |
Undocumented |
Inherited from ColumnElement
(via ColumnClause
, NamedColumn
):
Method | cast |
Produce a type cast, i.e. CAST(<expression> AS <type>). |
Method | label |
Produce a column label, i.e. <columnname> AS <name>. |
Method | operate |
Operate on an argument. |
Method | reverse_operate |
Reverse operate on an argument. |
Method | self_group |
Apply a 'grouping' to this _expression.ClauseElement . |
Method | shares_lineage |
Return True if the given _expression.ColumnElement has a common ancestor to this _expression.ColumnElement . |
Method | __getattr__ |
Undocumented |
Method | _anon_label |
Undocumented |
Method | _dedupe_anon_label_idx |
label to apply to a column that is anon labeled, but repeated in the SELECT, so that we have to make an "extra anon" label that disambiguates it from the previous appearance. |
Method | _dedupe_anon_tq_label_idx |
Undocumented |
Method | _expression_label |
a suggested label to use in the case that the column has no name, which should be used if possible as the explicit 'AS <label>' where this expression would normally have an anon label. |
Method | _negate |
Undocumented |
Method | _proxy_key |
Undocumented |
Method | _uncached_proxy_set |
An 'uncached' version of proxy set. |
Method | comparator |
Undocumented |
Class Variable | _allow_label_resolve |
A flag that can be flipped to prevent a column from being resolvable by string label name. |
Class Variable | _alt_names |
Undocumented |
Class Variable | _is_implicitly_boolean |
Undocumented |
Property | _anon_key_label |
Provides a constant 'anonymous key label' for this ColumnElement. |
Property | _anon_name_label |
Provides a constant 'anonymous label' for this ColumnElement. |
Property | _anon_tq_key_label |
Undocumented |
Property | _anon_tq_label |
Undocumented |
Property | _key_label |
legacy; renamed to _tq_key_label |
Property | _label |
legacy; renamed to _tq_label |
Property | _select_iterable |
Undocumented |
Property | anon_key_label |
Undocumented |
Property | anon_label |
Undocumented |
Property | base_columns |
Undocumented |
Property | expression |
Return a column expression. |
Property | proxy_set |
Undocumented |
Inherited from ColumnArgumentOrKeyRole
(via ColumnClause
, NamedColumn
, ColumnElement
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, ColumnArgumentOrKeyRole
, ColumnArgumentRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from StatementOptionRole
(via ColumnClause
, NamedColumn
, ColumnElement
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, StatementOptionRole
, StructuralRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from WhereHavingRole
(via ColumnClause
, NamedColumn
, ColumnElement
):
Class Variable | _role_name |
Undocumented |
Inherited from AllowsLambdaRole
(via ColumnClause
, NamedColumn
, ColumnElement
, WhereHavingRole
, OnClauseRole
):
Class Variable | allows_lambda |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, WhereHavingRole
, OnClauseRole
, StructuralRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from BinaryElementRole
(via ColumnClause
, NamedColumn
, ColumnElement
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, BinaryElementRole
, ExpressionElementRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from OrderByRole
(via ColumnClause
, NamedColumn
, ColumnElement
):
Class Variable | _role_name |
Undocumented |
Inherited from AllowsLambdaRole
(via ColumnClause
, NamedColumn
, ColumnElement
, OrderByRole
):
Class Variable | allows_lambda |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, OrderByRole
, ByOfRole
, ColumnListRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from ColumnsClauseRole
(via ColumnClause
, NamedColumn
, ColumnElement
):
Class Variable | _role_name |
Undocumented |
Inherited from AllowsLambdaRole
(via ColumnClause
, NamedColumn
, ColumnElement
, ColumnsClauseRole
):
Class Variable | allows_lambda |
Undocumented |
Inherited from UsesInspection
(via ColumnClause
, NamedColumn
, ColumnElement
, ColumnsClauseRole
):
Class Variable | _post_inspect |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, ColumnsClauseRole
, ColumnListRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from LimitOffsetRole
(via ColumnClause
, NamedColumn
, ColumnElement
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, LimitOffsetRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from DMLColumnRole
(via ColumnClause
, NamedColumn
, ColumnElement
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, DMLColumnRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from DDLConstraintColumnRole
(via ColumnClause
, NamedColumn
, ColumnElement
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, DDLConstraintColumnRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from DDLExpressionRole
(via ColumnClause
, NamedColumn
, ColumnElement
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, DDLExpressionRole
, StructuralRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from ColumnOperators
(via ColumnClause
, NamedColumn
, ColumnElement
):
Method | __add__ |
Implement the + operator. |
Method | __contains__ |
Undocumented |
Method | __div__ |
Implement the / operator. |
Method | __eq__ |
Implement the == operator. |
Method | __ge__ |
Implement the >= operator. |
Method | __getitem__ |
Implement the [] operator. |
Method | __gt__ |
Implement the > operator. |
Method | __le__ |
Implement the <= operator. |
Method | __lshift__ |
implement the << operator. |
Method | __lt__ |
Implement the < operator. |
Method | __mod__ |
Implement the % operator. |
Method | __mul__ |
Implement the * operator. |
Method | __ne__ |
Implement the != operator. |
Method | __neg__ |
Implement the - operator. |
Method | __radd__ |
Implement the + operator in reverse. |
Method | __rdiv__ |
Implement the / operator in reverse. |
Method | __rmod__ |
Implement the % operator in reverse. |
Method | __rmul__ |
Implement the * operator in reverse. |
Method | __rshift__ |
implement the >> operator. |
Method | __rsub__ |
Implement the - operator in reverse. |
Method | __rtruediv__ |
Implement the // operator in reverse. |
Method | __sub__ |
Implement the - operator. |
Method | __truediv__ |
Implement the // operator. |
Method | all_ |
Produce an _expression.all_ clause against the parent object. |
Method | any_ |
Produce an _expression.any_ clause against the parent object. |
Method | asc |
Produce a _expression.asc clause against the parent object. |
Method | between |
Produce a _expression.between clause against the parent object, given the lower and upper range. |
Method | collate |
Produce a _expression.collate clause against the parent object, given the collation string. |
Method | concat |
Implement the 'concat' operator. |
Method | contains |
Implement the 'contains' operator. |
Method | desc |
Produce a _expression.desc clause against the parent object. |
Method | distinct |
Produce a _expression.distinct clause against the parent object. |
Method | endswith |
Implement the 'endswith' operator. |
Method | ilike |
Implement the ilike operator, e.g. case insensitive LIKE. |
Method | in_ |
Implement the in operator. |
Method | is_ |
Implement the IS operator. |
Method | is_distinct_from |
Implement the IS DISTINCT FROM operator. |
Method | is_not |
Implement the IS NOT operator. |
Method | is_not_distinct_from |
Implement the IS NOT DISTINCT FROM operator. |
Method | like |
Implement the like operator. |
Method | match |
Implements a database-specific 'match' operator. |
Method | not_ilike |
implement the NOT ILIKE operator. |
Method | not_in |
implement the NOT IN operator. |
Method | not_like |
implement the NOT LIKE operator. |
Method | nulls_first |
Produce a _expression.nulls_first clause against the parent object. |
Method | nulls_last |
Produce a _expression.nulls_last clause against the parent object. |
Method | regexp_match |
Implements a database-specific 'regexp match' operator. |
Method | regexp_replace |
Implements a database-specific 'regexp replace' operator. |
Method | startswith |
Implement the startswith operator. |
Class Variable | __slots__ |
Undocumented |
Class Variable | timetuple |
Hack, allows datetime objects to be compared on the LHS. |
Inherited from Operators
(via ColumnClause
, NamedColumn
, ColumnElement
, ColumnOperators
):
Method | __and__ |
Implement the & operator. |
Method | __invert__ |
Implement the ~ operator. |
Method | __or__ |
Implement the | operator. |
Method | bool_op |
Return a custom boolean operator. |
Method | op |
Produce a generic operator function. |
Inherited from ClauseElement
(via ColumnClause
, NamedColumn
, ColumnElement
):
Method | compare |
Compare this _expression.ClauseElement to the given _expression.ClauseElement . |
Method | compile |
Compile this SQL expression. |
Method | params |
Return a copy with _expression.bindparam elements replaced. |
Method | unique_params |
Return a copy with _expression.bindparam elements replaced. |
Method | __bool__ |
Undocumented |
Method | __getstate__ |
Undocumented |
Method | __invert__ |
Undocumented |
Method | _cloned_set |
Return the set consisting all cloned ancestors of this ClauseElement. |
Method | _compile_w_cache |
Undocumented |
Method | _compiler |
Return a compiler appropriate for this ClauseElement, given a Dialect. |
Method | _execute_on_connection |
Undocumented |
Method | _negate_in_binary |
a hook to allow the right side of a binary expression to respond to a negation of the binary expression. |
Method | _replace_params |
Undocumented |
Method | _set_propagate_attrs |
Undocumented |
Method | _ungroup |
Return this _expression.ClauseElement without any groupings. |
Method | _with_binary_element_type |
in the context of binary expression, convert the type of this object to the one given. |
Class Variable | _cache_key_traversal |
Undocumented |
Class Variable | _is_bind_parameter |
Undocumented |
Class Variable | _is_clause_list |
Undocumented |
Class Variable | _is_clone_of |
Undocumented |
Class Variable | _is_from_clause |
Undocumented |
Class Variable | _is_from_container |
Undocumented |
Class Variable | _is_immutable |
Undocumented |
Class Variable | _is_lambda_element |
Undocumented |
Class Variable | _is_returns_rows |
Undocumented |
Class Variable | _is_select_container |
Undocumented |
Class Variable | _is_select_statement |
Undocumented |
Class Variable | _is_singleton_constant |
Undocumented |
Class Variable | _is_text_clause |
Undocumented |
Class Variable | _is_textual |
Undocumented |
Class Variable | _order_by_label_element |
Undocumented |
Class Variable | bind |
Undocumented |
Class Variable | is_clause_element |
Undocumented |
Class Variable | is_selectable |
Undocumented |
Class Variable | stringify_dialect |
Undocumented |
Class Variable | supports_execution |
Undocumented |
Instance Variable | _propagate_attrs |
like annotations, however these propagate outwards liberally as SQL constructs are built, and are set up at construction time. |
Property | _constructor |
return the 'constructor' for this ClauseElement. |
Inherited from SQLRole
(via ColumnClause
, NamedColumn
, ColumnElement
, ClauseElement
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from SupportsWrappingAnnotations
(via ColumnClause
, NamedColumn
, ColumnElement
, ClauseElement
):
Method | _annotate |
return a copy of this ClauseElement with annotations updated by the given dictionary. |
Method | _deannotate |
return a copy of this _expression.ClauseElement with annotations removed. |
Method | _with_annotations |
return a copy of this ClauseElement with annotations replaced by the given dictionary. |
Inherited from SupportsAnnotations
(via ColumnClause
, NamedColumn
, ColumnElement
, ClauseElement
, SupportsWrappingAnnotations
):
Property | _annotations_cache_key |
Undocumented |
Inherited from MemoizedHasCacheKey
(via ColumnClause
, NamedColumn
, ColumnElement
, ClauseElement
):
Method | _generate_cache_key |
return a cache key. |
Inherited from HasCacheKey
(via ColumnClause
, NamedColumn
, ColumnElement
, ClauseElement
, MemoizedHasCacheKey
):
Class Method | _generate_cache_attrs |
generate cache key dispatcher for a new class. |
Class Method | _generate_cache_key_for_object |
Undocumented |
Method | _gen_cache_key |
return an optional cache key. |
Class Variable | __slots__ |
Undocumented |
Class Variable | _hierarchy_supports_caching |
private attribute which may be set to False to prevent the inherit_cache warning from being emitted for a hierarchy of subclasses. |
Class Variable | _is_has_cache_key |
Undocumented |
Inherited from HasCopyInternals
(via ColumnClause
, NamedColumn
, ColumnElement
, ClauseElement
):
Method | _copy_internals |
Reassign internal elements to be clones of themselves. |
Inherited from Traversible
(via ColumnClause
, NamedColumn
, ColumnElement
, ClauseElement
):
Method | __class_getitem__ |
Undocumented |
Parameters | |
*args | Additional positional arguments include various
.SchemaItem derived constructs which will be applied
as options to the column. These include instances of
.Constraint , _schema.ForeignKey ,
.ColumnDefault , .Sequence , .Computed
.Identity . In some cases an
equivalent keyword argument is available such as server_default,
default and unique. |
**kwargs | Undocumented |
name | The name of this column as represented in the database. This argument may be the first positional argument, or specified via keyword. Names which contain no upper case characters will be treated as case insensitive names, and will not be quoted unless they are a reserved word. Names with any number of upper case characters will be quoted and sent exactly. Note that this behavior applies even for databases which standardize upper case names as case insensitive such as Oracle. The name field may be omitted at construction time and applied
later, at any time before the Column is associated with a
|
type_ | The column's type, indicated using an instance which
subclasses # use a type with arguments Column('data', String(50)) # use no arguments Column('level', Integer) The type argument may be the second positional argument or specified by keyword. If the type is None or is omitted, it will first default to
the special type
Changed in version 0.9.0: Support for propagation of type to a
_schema.Column
from its
_schema.ForeignKey object has been improved and should be
more reliable and timely. |
autoincrement | Set up "auto increment" semantics for an integer
primary key column. The default value is the string "auto"
which indicates that a single-column primary key that is of
an INTEGER type with no stated client-side or python-side defaults
should receive auto increment semantics automatically;
all other varieties of primary key columns will not. This
includes that :term:`DDL` such as PostgreSQL SERIAL or MySQL
AUTO_INCREMENT will be emitted for this column during a table
create, as well as that the column is assumed to generate new
integer primary key values when an INSERT statement invokes which
will be retrieved by the dialect. When used in conjunction with
The flag may be set to True to indicate that a column which is part of a composite (e.g. multi-column) primary key should have autoincrement semantics, though note that only one column within a primary key may have this setting. It can also be set to True to indicate autoincrement semantics on a column that has a client-side or server-side default configured, however note that not all dialects can accommodate all styles of default as an "autoincrement". It can also be set to False on a single-column primary key that has a datatype of INTEGER in order to disable auto increment semantics for that column.
Changed in version 1.1: The autoincrement flag now defaults to
"auto" which indicates autoincrement semantics by default
for single-column integer primary keys only; for composite
(multi-column) primary keys, autoincrement is never implicitly
enabled; as always, autoincrement=True will allow for
at most one of those columns to be an "autoincrement" column.
autoincrement=True may also be set on a
_schema.Column
that has an explicit client-side or server-side default,
subject to limitations of the backend database and dialect.The setting only has an effect for columns which are:
The setting has these two effects on columns that meet the above criteria:
|
default | A scalar, Python callable, or
Contrast this argument to :paramref:`_schema.Column.server_default` which creates a default generator on the database side. See Also |
doc | optional String that can be used by the ORM or similar to document attributes on the Python side. This attribute does not render SQL comments; use the :paramref:`_schema.Column.comment` parameter for this purpose. |
key | An optional string identifier which will identify this
Column object on the _schema.Table .
When a key is provided,
this is the only identifier referencing the Column within the
application, including ORM attribute mapping; the name field
is used only when rendering SQL. |
index | When True, indicates that a Using this flag is equivalent to making use of the
Table( "some_table", metadata, Column("x", Integer), Index("ix_some_table_x", "x") ) To add the :paramref:`_schema.Index.unique` flag to the
The name of the index is generated using the
:ref:`default naming convention <constraint_default_naming_convention>`
which for the As this flag is intended only as a convenience for the common case
of adding a single-column, default configured index to a table
definition, explicit use of the Note the |
info | Optional data dictionary which will be populated into the
.SchemaItem.info attribute of this object. |
nullable | When set to False, will cause the "NOT NULL"
phrase to be added when generating DDL for the column. When
True, will normally generate nothing (in SQL this defaults to
"NULL"), except in some very specific backend-specific edge cases
where "NULL" may render explicitly.
Defaults to True unless :paramref:`_schema.Column.primary_key`
is also True or the column specifies a Note When the column specifies a |
onupdate | A scalar, Python callable, or
See Also :ref:`metadata_defaults` - complete discussion of onupdate |
primary_key | If True, marks this column as a primary key
column. Multiple columns can have this flag set to specify
composite primary keys. As an alternative, the primary key of a
_schema.Table can be specified via an explicit
.PrimaryKeyConstraint object. |
server_default | A String types will be emitted as-is, surrounded by single quotes: Column('x', Text, server_default="val") x TEXT DEFAULT 'val' A Column('y', DateTime, server_default=text('NOW()')) y DATETIME DEFAULT NOW() Strings and text() will be converted into a
This parameter can also accept complex combinations of contextually valid SQLAlchemy expressions or constructs: from sqlalchemy import create_engine from sqlalchemy import Table, Column, MetaData, ARRAY, Text from sqlalchemy.dialects.postgresql import array engine = create_engine( 'postgresql://scott:tiger@localhost/mydatabase' ) metadata_obj = MetaData() tbl = Table( "foo", metadata_obj, Column("bar", ARRAY(Text), server_default=array(["biz", "bang", "bash"]) ) ) metadata_obj.create_all(engine) The above results in a table created with the following SQL: CREATE TABLE foo ( bar TEXT[] DEFAULT ARRAY['biz', 'bang', 'bash'] ) Use See Also :ref:`server_defaults` - complete discussion of server side defaults |
server_onupdate | A Warning This directive does not currently produce MySQL's "ON UPDATE CURRENT_TIMESTAMP()" clause. See :ref:`mysql_timestamp_onupdate` for background on how to produce this clause. See Also |
quote | Force quoting of this column's name on or off, corresponding to True or False. When left at its default of None, the column identifier will be quoted according to whether the name is case sensitive (identifiers with at least one upper case character are treated as case sensitive), or if it's a reserved word. This flag is only needed to force quoting of a reserved word which is not known by the SQLAlchemy dialect. |
unique | When True, and the :paramref:`_schema.Column.index`
parameter is left at its default value of False,
indicates that a When this flag is True while the
:paramref:`_schema.Column.index` parameter is simultaneously
set to True, the effect instead is that a
Using this flag is equivalent to making use of the
Table( "some_table", metadata, Column("x", Integer), UniqueConstraint("x") ) The :paramref:`_schema.UniqueConstraint.name` parameter
of the unique constraint object is left at its default value
of None; in the absence of a :ref:`naming convention <constraint_naming_conventions>`
for the enclosing As this flag is intended only as a convenience for the common case
of adding a single-column, default configured unique constraint to a table
definition, explicit use of the Note the |
system | When True, indicates this is a "system" column, that is a column which is automatically made available by the database, and should not be included in the columns list for a CREATE TABLE statement. For more elaborate scenarios where columns should be
conditionally rendered differently on different backends,
consider custom compilation rules for |
comment | Optional string that will render an SQL comment on table creation.
New in version 1.2: Added the
:paramref:`_schema.Column.comment`
parameter to
_schema.Column . |
Create a copy of this Column, uninitialized.
This is used in _schema.Table.to_metadata
.
Create a proxy for this column.
This is a copy of this Column referenced by a different parent (such as an alias or select statement). The column should be used only in select scenarios, as its full DDL/default information is not transferred.
Undocumented
bool
=
Indicate if this .HasCacheKey
instance should make use of the
cache key generation scheme used by its immediate superclass.
The attribute defaults to None, which indicates that a construct has not yet taken into account whether or not its appropriate for it to participate in caching; this is functionally equivalent to setting the value to False, except that a warning is also emitted.
This flag can be set to True on a particular class, if the SQL that corresponds to the object does not change based on attributes which are local to this class, and not its superclass.
See Also
:ref:`compilerext_caching` - General guideslines for setting the
.HasCacheKey.inherit_cache
attribute for third-party or user
defined SQL constructs.
A collection of all _schema.ForeignKey
marker objects
associated with this _schema.Column
.
Each object is a member of a _schema.Table
-wide
_schema.ForeignKeyConstraint
.
See Also
_schema.Table.foreign_keys
The value of the :paramref:`_schema.Column.index` parameter.
Does not indicate if this _schema.Column
is actually indexed
or not; use _schema.Table.indexes
.
See Also
_schema.Table.indexes
sqlalchemy.sql.schema.SchemaItem.info
Info dictionary associated with the object, allowing user-defined
data to be associated with this .SchemaItem
.
The dictionary is automatically generated when first accessed.
It can also be specified in the constructor of some objects,
such as _schema.Table
and _schema.Column
.
sqlalchemy.sql.elements.ColumnClause.key
The 'key' that in some circumstances refers to this object in a Python namespace.
This typically refers to the "key" of the column as present in the
.c collection of a selectable, e.g. sometable.c["somekey"] would
return a _schema.Column
with a .key of "somekey".
The value of the :paramref:`_schema.Column.unique` parameter.
Does not indicate if this _schema.Column
is actually subject to
a unique constraint or not; use _schema.Table.indexes
and
_schema.Table.constraints
.
See Also
_schema.Table.indexes
_schema.Table.constraints
.