Participer au site avec un Tip
Rechercher
 

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 :

Module « sqlalchemy »

Classe « ForeignKey »

Informations générales

Héritage

builtins.object
    Traversible
builtins.object
    SchemaEventTarget
        SchemaItem
    builtins.object
        DialectKWArgs
            ForeignKey

Définition

class ForeignKey(DialectKWArgs, SchemaItem):

Description [extrait de ForeignKey.__doc__]

Defines a dependency between two columns.

    ``ForeignKey`` is specified as an argument to a :class:`_schema.Column`
    object,
    e.g.::

        t = Table("remote_table", metadata,
            Column("remote_id", ForeignKey("main_table.id"))
        )

    Note that ``ForeignKey`` is only a marker object that defines
    a dependency between two columns.   The actual constraint
    is in all cases represented by the :class:`_schema.ForeignKeyConstraint`
    object.   This object will be generated automatically when
    a ``ForeignKey`` is associated with a :class:`_schema.Column` which
    in turn is associated with a :class:`_schema.Table`.   Conversely,
    when :class:`_schema.ForeignKeyConstraint` is applied to a
    :class:`_schema.Table`,
    ``ForeignKey`` markers are automatically generated to be
    present on each associated :class:`_schema.Column`, which are also
    associated with the constraint object.

    Note that you cannot define a "composite" foreign key constraint,
    that is a constraint between a grouping of multiple parent/child
    columns, using ``ForeignKey`` objects.   To define this grouping,
    the :class:`_schema.ForeignKeyConstraint` object must be used, and applied
    to the :class:`_schema.Table`.   The associated ``ForeignKey`` objects
    are created automatically.

    The ``ForeignKey`` objects associated with an individual
    :class:`_schema.Column`
    object are available in the `foreign_keys` collection
    of that column.

    Further examples of foreign key configuration are in
    :ref:`metadata_foreignkeys`.

    

Constructeur(s)

Signature du constructeur Description
__init__(self, column, _constraint=None, use_alter=False, name=None, onupdate=None, ondelete=None, deferrable=None, initially=None, link_to_name=False, match=None, info=None, **dialect_kw)

Liste des attributs statiques

Nom de l'attribut Valeur
column<sqlalchemy.util.langhelpers.memoized_property object at 0x7f40cbaead10>
create_drop_stringify_dialectdefault
dialect_kwargs<sqlalchemy.util.langhelpers.memoized_property object at 0x7f40cbecc6d0>
dialect_options<sqlalchemy.util.langhelpers.memoized_property object at 0x7f40cbece8c0>
dispatch<sqlalchemy.event.base.DDLEventsDispatch object at 0x7f40cbc2af40>
info<sqlalchemy.util.langhelpers.memoized_property object at 0x7f40cbc85d20>

Liste des propriétés

Nom de la propriétéDescription
kwargsA synonym for :attr:`.DialectKWArgs.dialect_kwargs`. [extrait de __doc__]
target_fullnameReturn a string based 'column specification' for this [extrait de __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
Signature de la méthodeDescription
__repr__(self)
copy(self, schema=None, **kw)
get_referent(self, table) Return the :class:`_schema.Column` in the given [extrait de get_referent.__doc__]
references(self, table) Return True if the given :class:`_schema.Table` [extrait de references.__doc__]

Méthodes héritées de la classe SchemaItem

__init_subclass__, __subclasshook__

Méthodes héritées de la classe Traversible

__class_getitem__, get_children

Méthodes héritées de la classe DialectKWArgs

argument_for

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__