From 9a9360cbdb67da44cabb87a713f2d9fa126064e0 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Fri, 29 May 2026 18:08:34 +0200 Subject: [PATCH] a bit simpler --- stand/api.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/stand/api.py b/stand/api.py index 228c2ab..cfb2c35 100644 --- a/stand/api.py +++ b/stand/api.py @@ -20,18 +20,14 @@ def append(beamline: Beamline, pgroup: PGroup, run: int, row: dict[str, Any]): index = pd.Timestamp(run) # adb supports update only for timeseries indexes index = pd.Index([index], name="run") - run_exists = not adb.get(beamline).read( - pgroup, - date_range=index, - columns=[] - ).data.index.empty + lib = adb.get(beamline) + run_exists = not lib.read(pgroup, date_range=index, columns=[]).data.index.empty if run_exists: raise HTTPException(409, f"run {run} exists already in {beamline}/{pgroup}") df = pd.DataFrame(row, index=index) - - adb.get(beamline).append(pgroup, df) + lib.append(pgroup, df) row = {"run": run, **row} # setdefault would not force run to be the first column