Closed serge-eric-kalaga closed 8 months ago
I finally found a solution. Here is the updated code
import asyncio
DATABASE_URL = "sqlite+aiosqlite:///./test.db"
engine = create_async_engine(DATABASE_URL, echo=True)
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
async def create_tables():
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)
loop = asyncio.get_event_loop()
loop.run_until_complete(create_tables())
loop.close()
Error initializing database Here is a piece of code that relates to the error
AttributeError: 'AsyncEngine' object has no attribute '_run_ddl_visitor'
How can I resolve this error?