Spaces:
Running
Running
File size: 503 Bytes
8d7950f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import asyncio
from sqlmodel import SQLModel
from sqlalchemy.ext.asyncio import create_async_engine
async def test_db():
try:
engine = create_async_engine("sqlite+aiosqlite:///./leadpilot.db")
async with engine.begin() as conn:
print("Connected to DB")
await conn.run_sync(SQLModel.metadata.create_all)
print("Tables checked/created")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
asyncio.run(test_db())
|