PyvsimDatabasable

class pyvsim.Core.PyvsimDatabasable[source]

This class provides another serialization method for some objects - in a database.

Methods

contributeToDB(overwrite=False)[source]

Contributes to the database with the current object parameters. By default no overwriting is allowed. Each entry is defined by the “name” field.

Parameters :

overwrite : boolean

If False, will not allow an entry in the database to be modified.

Raises :

ValueError :

When an entry with the same name already exists in the database

db[source]

Returns the database object where libraries of parameters are stored.

fetchFromDB(name)[source]

Redefines the current object with data received from the database in the form of a dictionary.

Parameters :

dbdict : dict

A dict received from the database and decodable by pyvsimJSONDecoder. The dict must have all the fields defined in self.dbParameters

Raises :

KeyError :

If the received dict doesn’t have all the parameters defined in self.dbParameters

listDB()[source]

Returns a list listing the current database entries in the category of the object. E.g.: using this method in a Glass material will list only the available glasses, etc.

Returns :

dblist : list

List of strings containing all entries in a database category

This Page