spinedb_api.purge

Functions to purge DBs.

Functions

purge_url(→ bool)

Removes all items of selected types from the database at a given URL.

purge(→ bool)

Removes all items of selected types from a database.

Module Contents

spinedb_api.purge.purge_url(url: str, purge_settings: dict[str, bool] | None, logger=None) bool[source]

Removes all items of selected types from the database at a given URL.

Purges everything if purge_settings is None.

Parameters:
  • url – database URL

  • purge_settings – mapping from item type to a boolean indicating whether to remove them or not

  • logger – logger

Returns:

True if operation was successful, False otherwise

spinedb_api.purge.purge(db_map: spinedb_api.db_mapping.DatabaseMapping, purge_settings: dict[str, bool] | None, logger=None) bool[source]

Removes all items of selected types from a database.

Purges everything if purge_settings is None.

Parameters:
  • db_map – target database mapping

  • purge_settings – mapping from item type to a boolean indicating whether to remove them or not

  • logger – logger

Returns:

True if operation was successful, False otherwise