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

Method __init__

lib/sqlalchemy/sql/schema.py:5620–5684  ·  view source on GitHub ↗

r"""Construct an index object. :param name: The name of the index :param \*expressions: Column expressions to include in the index. The expressions are normally instances of :class:`_schema.Column`, but may also be arbitrary SQL expressions

(
        self,
        name: Optional[str],
        *expressions: _DDLColumnArgument,
        unique: bool = False,
        quote: Optional[bool] = None,
        info: Optional[_InfoType] = None,
        _table: Optional[Table] = None,
        _column_flag: bool = False,
        **dialect_kw: Any,
    )

Source from the content-addressed store, hash-verified

5618 _table_bound_expressions: _typing_Sequence[ColumnElement[Any]]
5619
5620 def __init__(
5621 self,
5622 name: Optional[str],
5623 *expressions: _DDLColumnArgument,
5624 unique: bool = False,
5625 quote: Optional[bool] = None,
5626 info: Optional[_InfoType] = None,
5627 _table: Optional[Table] = None,
5628 _column_flag: bool = False,
5629 **dialect_kw: Any,
5630 ) -> None:
5631 r"""Construct an index object.
5632
5633 :param name:
5634 The name of the index
5635
5636 :param \*expressions:
5637 Column expressions to include in the index. The expressions
5638 are normally instances of :class:`_schema.Column`, but may also
5639 be arbitrary SQL expressions which ultimately refer to a
5640 :class:`_schema.Column`.
5641
5642 :param unique=False:
5643 Keyword only argument; if True, create a unique index.
5644
5645 :param quote=None:
5646 Keyword only argument; whether to apply quoting to the name of
5647 the index. Works in the same manner as that of
5648 :paramref:`_schema.Column.quote`.
5649
5650 :param info=None: Optional data dictionary which will be populated
5651 into the :attr:`.SchemaItem.info` attribute of this object.
5652
5653 :param \**dialect_kw: Additional keyword arguments not mentioned above
5654 are dialect specific, and passed in the form
5655 ``<dialectname>_<argname>``. See the documentation regarding an
5656 individual dialect at :ref:`dialect_toplevel` for detail on
5657 documented arguments.
5658
5659 """
5660 self.table = table = None
5661
5662 self.name = quoted_name.construct(name, quote)
5663 self.unique = unique
5664 if info is not None:
5665 self.info = info
5666
5667 # TODO: consider "table" argument being public, but for
5668 # the purpose of the fix here, it starts as private.
5669 if _table is not None:
5670 table = _table
5671
5672 self._validate_dialect_kwargs(dialect_kw)
5673
5674 self.expressions = []
5675 # will call _set_parent() if table-bound column
5676 # objects are present
5677 ColumnCollectionMixin.__init__(

Callers

nothing calls this directly

Calls 4

_set_parentMethod · 0.95
constructMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected