from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from dbapi.tables import metadata_obj class FitnessDatabseMigrator: """Class for performing management operations with database""" def __init__(self, async_engine: AsyncEngine) -> None: self.engine = async_engine async def reset_database(self): """Method for dropping all tables and create them from tables metadata""" async with self.engine.begin() as conn: await conn.run_sync(metadata_obj.drop_all) await conn.run_sync(metadata_obj.create_all)