From d7dda41fd85a117394e1d49eea1b42700714a752 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Fri, 27 May 2022 19:52:30 +0200 Subject: [PATCH] dump on demand --- stand.py | 3 --- tableapi.py | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/stand.py b/stand.py index 22e23e8..50c5530 100644 --- a/stand.py +++ b/stand.py @@ -47,9 +47,6 @@ if not new_df.equals(df) and not changed: restapi.data = df = new_df -restapi.dfh.dump() - - print(">>> end of streamlit run") diff --git a/tableapi.py b/tableapi.py index b901102..7607523 100644 --- a/tableapi.py +++ b/tableapi.py @@ -19,7 +19,11 @@ class TableAPI: @data.setter def data(self, df): + if self.dfh.df.equals(df): + print("<<< skipping dump because dataframe did not change") + return self.dfh.df = df + self.dfh.dump() def GET(self): @@ -30,6 +34,7 @@ class TableAPI: kwargs = kwargs or cp.request.json self.dfh.append(kwargs) self._trigger_changed() + self.dfh.dump() return str(self.dfh.df) def DELETE(self):