17 lines
487 B
Python
17 lines
487 B
Python
import asyncio
|
|
from sqlalchemy.ext.asyncio import create_async_engine
|
|
|
|
async def test():
|
|
# Using relative path from the current directory (root) to backend/data/sleep.db
|
|
engine = create_async_engine('sqlite+aiosqlite:///./backend/data/sleep.db')
|
|
try:
|
|
async with engine.begin() as conn:
|
|
print('Success')
|
|
except Exception as e:
|
|
print(f'Error: {e}')
|
|
finally:
|
|
await engine.dispose()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test())
|