diff --git a/stand/adb.py b/stand/adb.py index cc1b961..618b855 100644 --- a/stand/adb.py +++ b/stand/adb.py @@ -48,6 +48,13 @@ class ArcticLibrary: self.lib.update(symbol, df) + def append_data(self, symbol, df): + df.index = df.index.view("datetime64[ns]") # adb supports update only for timeseries indexes + df.index.name = "run" + + self.lib.append(symbol, df) + + def has_index(self, symbol, index): index = encode_index(index) diff --git a/stand/api.py b/stand/api.py index ca79486..122765c 100644 --- a/stand/api.py +++ b/stand/api.py @@ -30,11 +30,8 @@ def append_run(beamline: Beamline, pgroup: PGroup, run: int, row: dict[str, Any] timestamp = datetime.fromisoformat(timestamp) if timestamp else datetime.now() row = {"timestamp": timestamp, **row} # setdefault would not force timestamp to be the first column - index = pd.Timestamp(run) # adb supports update only for timeseries indexes - index = pd.Index([index], name="run") - - df = pd.DataFrame(row, index=index) - lib.append(pgroup, df) + df = pd.DataFrame(row, index=[run]) + lib.append_data(pgroup, df) row = {"run": run, **row} # setdefault would not force run to be the first column