meta = MetaData()
meta.reflect(bind=engine)
for table in list(meta.tables.values()):
    print('\nclass %s(Base):\n    __table__ = Table(%r, Base.metadata, autoload=True)\n' % (
        table.name, table.name))
Reverse engineer SQLAlchemy declarative class definition from existing MySQL database?