def find_model_by_table_name ( name ) : for model in ModelBase . _decl_class_registry . values ( ) : if hasattr ( model , '__table__' ) and model . __table__ . fullname == name : return model return None
python alembic get table
Find a model reference by its table name
def find_model_by_table_name(name):
    """Find a model reference by its table name"""

    for model in ModelBase._decl_class_registry.values():
        if hasattr(model, '__table__') and model.__table__.fullname == name:
            return model
    return None