In-memory Backend (cyclus.memback)

An in-memory Python backend for Cyclus.

class cyclus.memback.MemBack

An in-memory Python backend database.

Note that even though the underlying C++ class is a RecBackend, the Python wrapper inherits from FullBackend and the QueryableBackend interface in implemented in Cython.

Parameters:

registry : set, bool, or None, optional

The initial registry to start the backend with. Defaults is True, which stores all of the tables.

fallback : QueryableBackend-like, optional

A backend, which implements query(), that this backend can use to look up values if the table is not in the current cache.

close()

Closes the backend, flushing it in the process.

flush()

No-op since in-memory.

name

The name of the database.

query()

Queries a database table.

Parameters:

table : str

The table name.

conds : iterable, optional

A list of conditions.

Returns:

results : pd.DataFrame

Pandas DataFrame the represents the table. If None is returned, the table could not be found.

registry

A set of table names to store when store_all_tables is true. Setting this to True will store all tables. Setting this to None or False will clear all currently registered table names. Otherwise, Setting this to a set of strings will restrict the storage to just the specified tables. Setting the registry will also clear old cache values.

schema()
store_all_tables

Whether or not the backend will store all tables or only those in the registry.

tables

Retrieves the set of tables present in the database.