scmdata.database.backends.base

Interface for the base database backend

All other database backends should be based upon this interface

BaseDatabaseBackend

class BaseDatabaseBackend(**kwargs)[source]

Bases: ABC

Abstract backend for serialising/deserialising data

Data is stored as objects represented by keys. These keys can be used later to load data.

delete(key)[source]

Delete a given key

Parameters:

key (str) –

abstract get(filters)[source]

Get all matching keys for a given filter

Parameters:

filters (dict of str) – String filters If a level is missing then all values are fetched

Returns:

list of str – Each item is a key which may contain data which is of interest

abstract load(key)[source]

Load data at a given key

Parameters:

key (str) – Key to load

Returns:

scmdata.ScmRun

abstract save(sr)[source]

Save data

Parameters:

sr (scmdata.ScmRun) –

Returns:

str – Key where the data is stored