diff --git a/pastastore/base.py b/pastastore/base.py index 1e71486..21a2f72 100644 --- a/pastastore/base.py +++ b/pastastore/base.py @@ -56,6 +56,11 @@ def __repr__(self): f"{self.n_models} models" ) + @property + def empty(self): + """Check if the database is empty.""" + return not any([self.n_oseries > 0, self.n_stresses > 0, self.n_models > 0]) + @abstractmethod def _get_library(self, libname: str): """Get library handle. diff --git a/pastastore/store.py b/pastastore/store.py index 97c71a3..45f6358 100644 --- a/pastastore/store.py +++ b/pastastore/store.py @@ -78,6 +78,11 @@ def __init__( self.plots = Plots(self) self.yaml = PastastoreYAML(self) + @property + def empty(self) -> bool: + """Check if the PastaStore is empty.""" + return self.conn.empty + def _register_connector_methods(self): """Register connector methods (internal method).""" methods = [