a bit simpler

This commit is contained in:
2026-05-29 18:08:34 +02:00
parent e3c53087a8
commit 9a9360cbdb
+3 -7
View File
@@ -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