Vous êtes un professionnel et vous avez besoin d'une formation ?
Programmation Python
Les fondamentaux
Voir le programme détaillé
Module « sqlalchemy »
Classe « Index »
Informations générales
Héritage
builtins.object
Visitable
builtins.object
EventTarget
SchemaEventTarget
SchemaItem
builtins.object
HasConditionalDDL
builtins.object
ColumnCollectionMixin
builtins.object
DialectKWArgs
Index
Définition
class Index(DialectKWArgs, ColumnCollectionMixin, HasConditionalDDL, SchemaItem):
help(Index)
A table-level INDEX.
Defines a composite (one or more column) INDEX.
E.g.::
sometable = Table(
"sometable",
metadata,
Column("name", String(50)),
Column("address", String(100)),
)
Index("some_index", sometable.c.name)
For a no-frills, single column index, adding
:class:`_schema.Column` also supports ``index=True``::
sometable = Table(
"sometable", metadata, Column("name", String(50), index=True)
)
For a composite index, multiple columns can be specified::
Index("some_index", sometable.c.name, sometable.c.address)
Functional indexes are supported as well, typically by using the
:data:`.func` construct in conjunction with table-bound
:class:`_schema.Column` objects::
Index("some_index", func.lower(sometable.c.name))
An :class:`.Index` can also be manually associated with a
:class:`_schema.Table`,
either through inline declaration or using
:meth:`_schema.Table.append_constraint`. When this approach is used,
the names
of the indexed columns can be specified as strings::
Table(
"sometable",
metadata,
Column("name", String(50)),
Column("address", String(100)),
Index("some_index", "name", "address"),
)
To support functional or expression-based indexes in this form, the
:func:`_expression.text` construct may be used::
from sqlalchemy import text
Table(
"sometable",
metadata,
Column("name", String(50)),
Column("address", String(100)),
Index("some_index", text("lower(name)")),
)
.. seealso::
:ref:`schema_indexes` - General information on :class:`.Index`.
:ref:`postgresql_indexes` - PostgreSQL-specific options available for
the :class:`.Index` construct.
:ref:`mysql_indexes` - MySQL-specific options available for the
:class:`.Index` construct.
:ref:`mssql_indexes` - MSSQL-specific options available for the
:class:`.Index` construct.
Constructeur(s)
Liste des attributs statiques
c | <sqlalchemy.util.langhelpers._memoized_property object at 0x0000020DA09BA7B0> |
columns | <sqlalchemy.util.langhelpers._memoized_property object at 0x0000020DA09BA750> |
create_drop_stringify_dialect | default |
dialect_kwargs | <sqlalchemy.util.langhelpers._memoized_property object at 0x0000020D9F4DE450> |
dialect_options | <sqlalchemy.util.langhelpers._memoized_property object at 0x0000020D9F4DDD50> |
dispatch | <sqlalchemy.event.base.DDLEventsDispatch object at 0x0000020D9F843260> |
info | <sqlalchemy.util.langhelpers._memoized_property object at 0x0000020D9F80A270> |
Liste des propriétés
kwargs | A synonym for :attr:`.DialectKWArgs.dialect_kwargs`. [extrait de kwargs.__doc__] |
Liste des opérateurs
Opérateurs hérités de la classe object
__eq__,
__ge__,
__gt__,
__le__,
__lt__,
__ne__
Liste des méthodes
Toutes les méthodes
Méthodes d'instance
Méthodes statiques
Méthodes dépréciées
Méthodes héritées de la classe SchemaItem
__subclasshook__
Méthodes héritées de la classe Visitable
__class_getitem__, __init_subclass__
Méthodes héritées de la classe HasConditionalDDL
ddl_if
Méthodes héritées de la classe DialectKWArgs
argument_for
Méthodes héritées de la classe object
__delattr__,
__dir__,
__format__,
__getattribute__,
__getstate__,
__hash__,
__reduce__,
__reduce_ex__,
__setattr__,
__sizeof__,
__str__
Vous êtes un professionnel et vous avez besoin d'une formation ?
Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :