def create_table_from_orm_class(engine: Engine,
                                ormclass: DeclarativeMeta,
                                without_constraints: bool = False) -> None:
    """
    From an SQLAlchemy ORM class, creates the database table via the specified
    engine, using a ``CREATE TABLE`` SQL (DDL) statement.

    Args:
        engine: SQLAlchemy :class:`Engine` object
        ormclass: SQLAlchemy ORM class
        without_constraints: don't add foreign key constraints
    """
    table = ormclass.__table__  # type: Table
    log.info("Creating table {} on engine {}{}",
             table.name,
             get_safe_url_from_engine(engine),
             " (omitting constraints)" if without_constraints else "")
    # https://stackoverflow.com/questions/19175311/how-to-create-only-one-table-with-sqlalchemy  # noqa
    if without_constraints:
        include_foreign_key_constraints = []
    else:
        include_foreign_key_constraints = None  # the default
    creator = CreateTable(
        table,
        include_foreign_key_constraints=include_foreign_key_constraints
    )
    creator.execute(bind=engine)
def create_table_from_orm_class ( engine : Engine , ormclass : DeclarativeMeta , without_constraints : bool = False ) -> None : table = ormclass . __table__ log . info ( "Creating table {} on engine {}{}" , table . name , get_safe_url_from_engine ( engine ) , " (omitting constraints)" if without_constraints else "" ) if without_constraints : include_foreign_key_constraints = [ ] else : include_foreign_key_constraints = None creator = CreateTable ( table , include_foreign_key_constraints = include_foreign_key_constraints ) creator . execute ( bind = engine )
From an SQLAlchemy ORM class, creates the database table via the specified
    engine, using a ``CREATE TABLE`` SQL (DDL) statement.

    Args:
        engine: SQLAlchemy :class:`Engine` object
        ormclass: SQLAlchemy ORM class
        without_constraints: don't add foreign key constraints