happi.backends.json_db.JSONBackend
- class happi.backends.json_db.JSONBackend(path: str, initialize: bool = False, cfg_path: str | None = None)
JSON database.
The happi information is kept in a single large dictionary that is stored using the
simplejson
package.- Parameters:
Methods
__init__
(path[, initialize, cfg_path])clear_cache
()Clear the loaded cache.
delete
(_id)Delete an item instance from the database.
find
(to_match)Find an instance or instances that matches the search criteria.
find_range
(key, *, start[, stop])Find an instance or instances that matches the search criteria, such that
start <= entry[key] < stop
.find_regex
(to_match, *[, flags])Find an instance or instances that matches the search criteria, using regular expressions.
get_by_id
(id_)Get an item by ID if it exists, or return None.
initialize
()Initialize a new JSON file database.
load
()Load the JSON database.
save
(_id, post[, insert])Save information to the database.
store
(db)Stash the database in the JSON file.
Attributes
all_items
All of the items in the database.