ApdbMetadata¶
- class lsst.dax.apdb.ApdbMetadata¶
Bases:
ABC
Interface for accessing APDB metadata.
Metadata is a collection of key/value items usually stored in a special table in the database. This abstract interface provides methods for accessing and modifying it.
Methods Summary
delete
(key)Delete metadata record.
empty
()Check whether attributes set is empty.
get
(key[, default])Retrieve value of a given metadata record.
items
()Iterate over records and yield their keys and values.
set
(key, value, *[, force])Set value for a given metadata record.
Methods Documentation
- abstract get(key: str, default: str | None = None) str | None ¶
Retrieve value of a given metadata record.
- abstract items() Generator[tuple[str, str], None, None] ¶
Iterate over records and yield their keys and values.
- abstract set(key: str, value: str, *, force: bool = False) None ¶
Set value for a given metadata record.
- Parameters:
- key
str
Metadata key, arbitrary non-empty string.
- value
str
New metadata value, an arbitrary string. Due to deficiencies of some database engines we are not allowing empty strings to be stored in the database, and
value
cannot be an empty string.- force
bool
, optional Controls handling of existing metadata. With default
False
value an exception is raised ifkey
already exists, ifTrue
is passed then value of the existing key will be updated.
- key
- Raises:
- KeyError
Raised if key already exists but
force
option is false.- ValueError
Raised if key or value parameters are empty.