MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __init__

Method __init__

lib/sqlalchemy/sql/schema.py:3082–3206  ·  view source on GitHub ↗

r""" Construct a column-level FOREIGN KEY. The :class:`_schema.ForeignKey` object when constructed generates a :class:`_schema.ForeignKeyConstraint` which is associated with the parent :class:`_schema.Table` object's collection of constraints. :param

(
        self,
        column: _DDLColumnReferenceArgument,
        _constraint: Optional[ForeignKeyConstraint] = None,
        use_alter: bool = False,
        name: _ConstraintNameArgument = None,
        onupdate: Optional[str] = None,
        ondelete: Optional[str] = None,
        deferrable: Optional[bool] = None,
        initially: Optional[str] = None,
        link_to_name: bool = False,
        match: Optional[str] = None,
        info: Optional[_InfoType] = None,
        comment: Optional[str] = None,
        _unresolvable: bool = False,
        **dialect_kw: Any,
    )

Source from the content-addressed store, hash-verified

3080 _colspec: Union[str, Column[Any]]
3081
3082 def __init__(
3083 self,
3084 column: _DDLColumnReferenceArgument,
3085 _constraint: Optional[ForeignKeyConstraint] = None,
3086 use_alter: bool = False,
3087 name: _ConstraintNameArgument = None,
3088 onupdate: Optional[str] = None,
3089 ondelete: Optional[str] = None,
3090 deferrable: Optional[bool] = None,
3091 initially: Optional[str] = None,
3092 link_to_name: bool = False,
3093 match: Optional[str] = None,
3094 info: Optional[_InfoType] = None,
3095 comment: Optional[str] = None,
3096 _unresolvable: bool = False,
3097 **dialect_kw: Any,
3098 ):
3099 r"""
3100 Construct a column-level FOREIGN KEY.
3101
3102 The :class:`_schema.ForeignKey` object when constructed generates a
3103 :class:`_schema.ForeignKeyConstraint`
3104 which is associated with the parent
3105 :class:`_schema.Table` object's collection of constraints.
3106
3107 :param column: A single target column for the key relationship. A
3108 :class:`_schema.Column` object or a column name as a string:
3109 ``tablename.columnkey`` or ``schema.tablename.columnkey``.
3110 ``columnkey`` is the ``key`` which has been assigned to the column
3111 (defaults to the column name itself), unless ``link_to_name`` is
3112 ``True`` in which case the rendered name of the column is used.
3113
3114 :param name: Optional string. An in-database name for the key if
3115 `constraint` is not provided.
3116
3117 :param onupdate: Optional string. If set, emit ON UPDATE <value> when
3118 issuing DDL for this constraint. Typical values include CASCADE,
3119 DELETE and RESTRICT.
3120
3121 .. seealso::
3122
3123 :ref:`on_update_on_delete`
3124
3125 :param ondelete: Optional string. If set, emit ON DELETE <value> when
3126 issuing DDL for this constraint. Typical values include CASCADE,
3127 SET NULL and RESTRICT. Some dialects may allow for additional
3128 syntaxes.
3129
3130 .. seealso::
3131
3132 :ref:`on_update_on_delete`
3133
3134 :param deferrable: Optional bool. If set, emit DEFERRABLE or NOT
3135 DEFERRABLE when issuing DDL for this constraint.
3136
3137 :param initially: Optional string. If set, emit INITIALLY <value> when
3138 issuing DDL for this constraint.
3139

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected