DbsTemplate
self, database: IDatabase) dbs_classes.DbsTemplate(
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
str) dbs_classes.DbsTemplate.check_higher_level_usage(name:
Check if an object is used in a higher level object.
Parameters
name :
str
-
name of the object to be checked
Returns
:
list
[str
]-
list of higher level objects that use the object
copy
str, new_name: str, new_description: str) dbs_classes.DbsTemplate.copy(old_name:
Copy (duplicate) an existing object, and give it a new name.
Parameters
old_name :
str
-
name of the existing measure
new_name :
str
-
name of the new measure
new_description :
str
-
description of the new measure
delete
str, toml_only: bool = False) dbs_classes.DbsTemplate.delete(name:
Delete an already existing object in the database.
Parameters
name :
str
-
name of the object to be deleted
toml_only :
bool
= False-
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
Raises
:
ValueError
-
Raise error if object to be deleted is already in use.
edit
dbs_classes.DbsTemplate.edit(object_model: T_OBJECTMODEL)
Edit an already existing object in the database.
Parameters
object_model : Object
-
object to be edited in the database
Raises
:
ValueError
-
Raise error if name is already in use.
get
str) dbs_classes.DbsTemplate.get(name:
Return an object of the type of the database with the given name.
Parameters
name :
str
-
name of the object to be returned
Returns
: Object
-
object of the type of the specified object model
list_objects
dbs_classes.DbsTemplate.list_objects()
Return a dictionary with info on the objects that currently exist in the database.
Returns
:
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.DbsTemplate.save(
object_model: T_OBJECTMODEL,bool = False,
overwrite: )
Save an object in the database and all associated files.
This saves the toml file and any additional files attached to the object.
Parameters
object_model : Object
-
object to be saved in the database
overwrite :
bool
= False-
whether to overwrite the object if it already exists in the database, by default False
Raises
:
ValueError
-
Raise error if name is already in use.