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

Method __init__

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

4222 ) -> None: ...
4223
4224 def __init__(
4225 self,
4226 *columns: _DDLColumnArgument,
4227 _autoattach: bool = True,
4228 _column_flag: bool = False,
4229 _gather_expressions: Optional[
4230 List[Union[str, ColumnElement[Any]]]
4231 ] = None,
4232 ) -> None:
4233 self._column_flag = _column_flag
4234 self._columns = DedupeColumnCollection()
4235
4236 processed_expressions: Optional[
4237 List[Union[ColumnElement[Any], str]]
4238 ] = _gather_expressions
4239
4240 if processed_expressions is not None:
4241
4242 # this is expected to be an empty list
4243 assert not processed_expressions
4244
4245 self._pending_colargs = []
4246 for (
4247 expr,
4248 _,
4249 _,
4250 add_element,
4251 ) in coercions.expect_col_expression_collection(
4252 roles.DDLConstraintColumnRole, columns
4253 ):
4254 self._pending_colargs.append(add_element)
4255 processed_expressions.append(expr)
4256 else:
4257 self._pending_colargs = [
4258 coercions.expect(roles.DDLConstraintColumnRole, column)
4259 for column in columns
4260 ]
4261
4262 if _autoattach and self._pending_colargs:
4263 self._check_attach()
4264
4265 def _check_attach(self, evt: bool = False) -> None:
4266 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