MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / __init__

Method __init__

lib/sqlalchemy/sql/schema.py:5228–5292  ·  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

5226 _table_bound_expressions: _typing_Sequence[ColumnElement[Any]]
5227
5228 def __init__(
5229 self,
5230 name: Optional[str],
5231 *expressions: _DDLColumnArgument,
5232 unique: bool = False,
5233 quote: Optional[bool] = None,
5234 info: Optional[_InfoType] = None,
5235 _table: Optional[Table] = None,
5236 _column_flag: bool = False,
5237 **dialect_kw: Any,
5238 ) -> None:
5239 r"""Construct an index object.
5240
5241 :param name:
5242 The name of the index
5243
5244 :param \*expressions:
5245 Column expressions to include in the index. The expressions
5246 are normally instances of :class:`_schema.Column`, but may also
5247 be arbitrary SQL expressions which ultimately refer to a
5248 :class:`_schema.Column`.
5249
5250 :param unique=False:
5251 Keyword only argument; if True, create a unique index.
5252
5253 :param quote=None:
5254 Keyword only argument; whether to apply quoting to the name of
5255 the index. Works in the same manner as that of
5256 :paramref:`_schema.Column.quote`.
5257
5258 :param info=None: Optional data dictionary which will be populated
5259 into the :attr:`.SchemaItem.info` attribute of this object.
5260
5261 :param \**dialect_kw: Additional keyword arguments not mentioned above
5262 are dialect specific, and passed in the form
5263 ``<dialectname>_<argname>``. See the documentation regarding an
5264 individual dialect at :ref:`dialect_toplevel` for detail on
5265 documented arguments.
5266
5267 """
5268 self.table = table = None
5269
5270 self.name = quoted_name.construct(name, quote)
5271 self.unique = unique
5272 if info is not None:
5273 self.info = info
5274
5275 # TODO: consider "table" argument being public, but for
5276 # the purpose of the fix here, it starts as private.
5277 if _table is not None:
5278 table = _table
5279
5280 self._validate_dialect_kwargs(dialect_kw)
5281
5282 self.expressions = []
5283 # will call _set_parent() if table-bound column
5284 # objects are present
5285 ColumnCollectionMixin.__init__(

Callers

nothing calls this directly

Calls 4

_set_parentMethod · 0.95
constructMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected