Functions to directly interact with the database¶
Insert / Upsert¶
To insert a new value, the easiest is to use the upsert_param.
This function is used to upsert a parameter (param) and its corresponding value (value) to the global database.
The function takes in 3 parameters: param, value, and obfuscate.
- The
paramparameter is a string that contains the parameter name. - The
valueparameter can take in any type of value, and it contains the value to be upserted to the database. - The
obfuscateparameter is a boolean value that determines if the parameter and its corresponding value will be obfuscated before being stored in the database.
The function uses the usual Query() and db.search(..) from tinydb.
The function upserts the param and value to the database, and also stores the timestamp, machine, and a boolean to indicate wether parameters are obfuscated.
Get Keys / Values¶
There are two pre-made functions: getKey and getValue. The key difference is as follows:
getKeyreturns all the values associated with keykeygetValuearbitrarily returns the first encountered value.