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

Method __init__

lib/sqlalchemy/sql/schema.py:4604–4643  ·  view source on GitHub ↗
(
        self,
        *columns: _DDLColumnArgument,
        _autoattach: bool = True,
        _column_flag: bool = False,
        _gather_expressions: Optional[
            List[Union[str, ColumnElement[Any]]]
        ] = None,
    )

Source from the content-addressed store, hash-verified

4602 ) -> None: ...
4603
4604 def __init__(
4605 self,
4606 *columns: _DDLColumnArgument,
4607 _autoattach: bool = True,
4608 _column_flag: bool = False,
4609 _gather_expressions: Optional[
4610 List[Union[str, ColumnElement[Any]]]
4611 ] = None,
4612 ) -> None:
4613 self._column_flag = _column_flag
4614 self._columns = DedupeColumnCollection()
4615
4616 processed_expressions: Optional[
4617 List[Union[ColumnElement[Any], str]]
4618 ] = _gather_expressions
4619
4620 if processed_expressions is not None:
4621
4622 # this is expected to be an empty list
4623 assert not processed_expressions
4624
4625 self._pending_colargs = []
4626 for (
4627 expr,
4628 _,
4629 _,
4630 add_element,
4631 ) in coercions.expect_col_expression_collection(
4632 roles.DDLConstraintColumnRole, columns
4633 ):
4634 self._pending_colargs.append(add_element)
4635 processed_expressions.append(expr)
4636 else:
4637 self._pending_colargs = [
4638 coercions.expect(roles.DDLConstraintColumnRole, column)
4639 for column in columns
4640 ]
4641
4642 if _autoattach and self._pending_colargs:
4643 self._check_attach()
4644
4645 def _check_attach(self, evt: bool = False) -> None:
4646 col_objs = [c for c in self._pending_colargs if isinstance(c, Column)]

Callers

nothing calls this directly

Calls 3

_check_attachMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected