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

Class CreateTable

lib/sqlalchemy/sql/ddl.py:514–545  ·  view source on GitHub ↗

Represent a CREATE TABLE statement.

Source from the content-addressed store, hash-verified

512
513
514class CreateTable(_CreateBase["Table"]):
515 """Represent a CREATE TABLE statement."""
516
517 __visit_name__ = "create_table"
518
519 def __init__(
520 self,
521 element: Table,
522 include_foreign_key_constraints: Optional[
523 typing_Sequence[ForeignKeyConstraint]
524 ] = None,
525 if_not_exists: bool = False,
526 ) -> None:
527 """Create a :class:`.CreateTable` construct.
528
529 :param element: a :class:`_schema.Table` that's the subject
530 of the CREATE
531 :param on: See the description for 'on' in :class:`.DDL`.
532 :param include_foreign_key_constraints: optional sequence of
533 :class:`_schema.ForeignKeyConstraint` objects that will be included
534 inline within the CREATE construct; if omitted, all foreign key
535 constraints that do not specify use_alter=True are included.
536
537 :param if_not_exists: if True, an IF NOT EXISTS operator will be
538 applied to the construct.
539
540 .. versionadded:: 1.4.0b2
541
542 """
543 super().__init__(element, if_not_exists=if_not_exists)
544 self.columns = [CreateColumn(column) for column in element.columns]
545 self.include_foreign_key_constraints = include_foreign_key_constraints
546
547
548class _DropView(_DropBase["Table"]):

Callers 15

visit_tableMethod · 0.85
test_create_ddlMethod · 0.85
test_other_optionsMethod · 0.85
test_nullable_kwargMethod · 0.85
test_on_nullMethod · 0.85
test_stringMethod · 0.85
test_string_w_quotesMethod · 0.85
test_textMethod · 0.85
test_text_w_quotesMethod · 0.85

Calls

no outgoing calls

Tested by 15

test_create_ddlMethod · 0.68
test_other_optionsMethod · 0.68
test_nullable_kwargMethod · 0.68
test_on_nullMethod · 0.68
test_stringMethod · 0.68
test_string_w_quotesMethod · 0.68
test_textMethod · 0.68
test_text_w_quotesMethod · 0.68