dbs_classes.dbs_template.DbsTemplate

dbs_classes.dbs_template.DbsTemplate(self, database)

Methods

Name Description
check_higher_level_usage Check if an object is used in a higher level object.
copy Copy (duplicate) an existing object, and give it a new name.
delete Delete an already existing object in the database.
edit Edit an already existing object in the database.
get Return an object of the type of the database with the given name.
list_objects Return a dictionary with info on the objects that currently exist in the database.
save Save an object in the database and all associated files.

check_higher_level_usage

dbs_classes.dbs_template.DbsTemplate.check_higher_level_usage(name)

Check if an object is used in a higher level object.

Parameters

Name Type Description Default
name str name of the object to be checked required

Returns

Name Type Description
list[str] list of higher level objects that use the object

copy

dbs_classes.dbs_template.DbsTemplate.copy(old_name, new_name, new_description)

Copy (duplicate) an existing object, and give it a new name.

Parameters

Name Type Description Default
old_name str name of the existing measure required
new_name str name of the new measure required
new_description str description of the new measure required

delete

dbs_classes.dbs_template.DbsTemplate.delete(name, toml_only=False)

Delete an already existing object in the database.

Parameters

Name Type Description Default
name str name of the object to be deleted required
toml_only bool whether to only delete the toml file or the entire folder. If the folder is empty after deleting the toml, it will always be deleted. By default False False

Raises

Name Type Description
ValueError Raise error if object to be deleted is already in use.

edit

dbs_classes.dbs_template.DbsTemplate.edit(object_model)

Edit an already existing object in the database.

Parameters

Name Type Description Default
object_model ObjectModel object to be edited in the database required

Raises

Name Type Description
ValueError Raise error if name is already in use.

get

dbs_classes.dbs_template.DbsTemplate.get(name)

Return an object of the type of the database with the given name.

Parameters

Name Type Description Default
name str name of the object to be returned required

Returns

Name Type Description
ObjectModel object of the type of the specified object model

list_objects

dbs_classes.dbs_template.DbsTemplate.list_objects()

Return a dictionary with info on the objects that currently exist in the database.

Returns

Name Type Description
dict[str, list[Any]] A dictionary that contains the keys: name, ‘path’, ‘last_modification_date’, ‘description’, ‘objects’ Each key has a list of the corresponding values, where the index of the values corresponds to the same object.

save

dbs_classes.dbs_template.DbsTemplate.save(object_model, overwrite=False)

Save an object in the database and all associated files.

This saves the toml file and any additional files attached to the object.

Parameters

Name Type Description Default
object_model ObjectModel object to be saved in the database required
overwrite bool whether to overwrite the object if it already exists in the database, by default False False

Raises

Name Type Description
ValueError Raise error if name is already in use.
Back to top