class Computed(FetchedValue, SchemaItem): (source)
Defines a generated column, i.e. "GENERATED ALWAYS AS" syntax. The :class:`.Computed` construct is an inline construct added to the argument list of a :class:`_schema.Column` object:: from sqlalchemy import Computed Table('square', metadata_obj, Column('side', Float, nullable=False), Column('area', Float, Computed('side * side')) ) See the linked documentation below for complete details. .. versionadded:: 1.3.11 .. seealso:: :ref:`computed_ddl`
Method | __init__ |
Construct a GENERATED ALWAYS AS DDL construct to accompany a :class:`_schema.Column`. |
Method | copy |
Undocumented |
Class Variable | __visit |
Undocumented |
Instance Variable | column |
Undocumented |
Instance Variable | persisted |
Undocumented |
Instance Variable | sqltext |
Undocumented |
Method | _as |
Undocumented |
Method | _copy |
Undocumented |
Method | _set |
Associate with this SchemaEvent's parent object. |
Inherited from FetchedValue
:
Method | __repr__ |
Undocumented |
Class Variable | has |
Undocumented |
Class Variable | is |
Undocumented |
Class Variable | is |
Undocumented |
Class Variable | reflected |
Undocumented |
Instance Variable | for |
Undocumented |
Method | _clone |
Undocumented |
Inherited from SchemaItem
(via FetchedValue
):
Class Variable | create |
Undocumented |
Property | info |
Info dictionary associated with the object, allowing user-defined data to be associated with this :class:`.SchemaItem`. |
Method | _init |
Initialize the list of child items for this SchemaItem. |
Method | _schema |
Undocumented |
Class Variable | _use |
Undocumented |
Inherited from SchemaEventTarget
(via FetchedValue
, SchemaItem
):
Class Variable | dispatch |
Undocumented |
Method | _set |
Undocumented |
Inherited from EventTarget
(via FetchedValue
, SchemaItem
, SchemaEventTarget
):
Class Variable | __slots__ |
Undocumented |
Inherited from Visitable
(via FetchedValue
, SchemaItem
, SchemaEventTarget
, EventTarget
):
Method | __class |
Undocumented |
Method | __init |
Undocumented |
Class Method | _generate |
Undocumented |
Method | _compiler |
Undocumented |
Class Variable | _original |
Undocumented |
def __init__(self, sqltext:
_DDLColumnArgument
, persisted: Optional[ bool]
= None):
(source)
¶
Construct a GENERATED ALWAYS AS DDL construct to accompany a :class:`_schema.Column`. :param sqltext: A string containing the column generation expression, which will be used verbatim, or a SQL expression construct, such as a :func:`_expression.text` object. If given as a string, the object is converted to a :func:`_expression.text` object. :param persisted: Optional, controls how this column should be persisted by the database. Possible values are: * ``None``, the default, it will use the default persistence defined by the database. * ``True``, will render ``GENERATED ALWAYS AS ... STORED``, or the equivalent for the target database if supported. * ``False``, will render ``GENERATED ALWAYS AS ... VIRTUAL``, or the equivalent for the target database if supported. Specifying ``True`` or ``False`` may raise an error when the DDL is emitted to the target database if the database does not support that persistence option. Leaving this parameter at its default of ``None`` is guaranteed to succeed for all databases that support ``GENERATED ALWAYS AS``.
def copy(self, *, target_table:
Optional[ Table]
= None, **kw: Any
) -> Computed
:
(source)
¶
Undocumented