From 6e8e3827184dc26f79f437b247c3784e0240300c Mon Sep 17 00:00:00 2001
From: Nicolas Schmid <nicolas@breiten.ch>
Date: Sun, 28 Apr 2024 19:16:49 +0200
Subject: [PATCH] fix: commit statement after creating partitioned table; only
 led to failure, when the next statement touched multiple of the newly
 (attempted) created partitions, no idea why

---
 hydws/crud.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hydws/crud.py b/hydws/crud.py
index fcc40bc..02f48b1 100644
--- a/hydws/crud.py
+++ b/hydws/crud.py
@@ -200,6 +200,7 @@ async def create_hydraulics(hydraulics: List[dict],
             datetime.strftime(start, '%Y-%m-%d'),
             datetime.strftime(end + timedelta(days=1), '%Y-%m-%d'))
     await db.execute(text(statement))
+    await db.commit()  # I have no idea why this is needed, but it is!!!!
 
     # check whether there are already samples in the database for that time
     count = await db.scalar(
-- 
GitLab