Add tear down

This commit is contained in:
2024-08-27 16:42:08 +02:00
parent 6d12f2850d
commit 28908255e7
3 changed files with 6 additions and 1 deletions

View File

@@ -41,6 +41,9 @@ class LocationRecorder:
async with self._engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)
async def dispose_db_engine(self) -> None:
await self._engine.dispose()
async def insert_location(self, people: str, datetime: str, location: LocationData) -> None:
async with self._engine.connect() as conn:
await conn.execute(
@@ -53,6 +56,7 @@ class LocationRecorder:
),
)
await conn.commit()
await conn.aclose()
async def insert_location_now(self, people: str, location: LocationData) -> None:
now = datetime.datetime.now(tz=datetime.UTC)