Belle II Software development
|
Public Member Functions | |
def | __init__ (self, filename, mode="read") |
def | get_payload_count (self) |
def | add_globaltag (self, tag_id, name, state, iovs) |
def | get_globaltags (self) |
def | get_payloads (self) |
def | get_all_iovs (self, globalTag, exp=None, run=None, message=None) |
Static Public Attributes | |
int | APPLICATION_ID = 0xb2cdb |
Application ID to be stored int the sqlite file. | |
int | SCHEMA_VERSION = 1 |
Schema version, to be increased when the table definitions change so that we can check for safe append operation. | |
str | SCHEMA_SQL |
SQL script to create all necessary tables and views. | |
Protected Member Functions | |
def | _resolve_id (self, name, entity) |
Protected Attributes | |
_cache | |
Cache name->id mappings from the database. | |
_database | |
sqlite Database connection | |
Class to handle local sqlite dump of conditions database metadata This class can create and read sqlite dumps of the central database in a format compatible with the local metadata provider in basf2.
Definition at line 20 of file local_metadata.py.
def __init__ | ( | self, | |
filename, | |||
mode = "read" |
|||
) |
Open an sqlite database and make sure that the schema exists in the correct version or create it if ``mode=overwrite`` Arguments: filename (str): name of the database file readonly (str): how to open the file. Can be one of ``read`` to open the file readonly, ``append` to append new data to an existing file and ``overwrite`` to recreate all tables and overwrite the contents.
Definition at line 124 of file local_metadata.py.
|
protected |
Resolve the id for a named entity in the database file. Create new entities on demand and cache all known entities Parameters: name (str): name to lookup entity (str): type of the entity, currently ``baseUrl`` or ``payloadName``
Definition at line 170 of file local_metadata.py.
def add_globaltag | ( | self, | |
tag_id, | |||
name, | |||
state, | |||
iovs | |||
) |
Add a globaltag to the database file. If the globaltag already exists in the file its contents will be replaced. Parameters: tag_id (str): id of the globaltag in the central database name (str): name of the globaltag in the central database state (str): state of the globaltag in the central database iovs (list(PayloadInformation)): all iovs valid for this globaltag
Definition at line 190 of file local_metadata.py.
def get_all_iovs | ( | self, | |
globalTag, | |||
exp = None , |
|||
run = None , |
|||
message = None |
|||
) |
Get all iovs for a given globaltag Parameters: globalTag (str): name of the globaltag exp (int): experiment number to check (or None to return all iovs) run (int): run number to check (or None to return all iovs) message (str): ignored, just for compatibility with `ConditionsDB.get_all_iovs` Returns: a sorted list of `PayloadInformation` objects
Definition at line 242 of file local_metadata.py.
def get_globaltags | ( | self | ) |
Return the list of globaltags stored in the file Returns: a list of (id, name, state) tuples for all globaltags
Definition at line 222 of file local_metadata.py.
def get_payload_count | ( | self | ) |
Get the number of distinct payloads known to this file
Definition at line 165 of file local_metadata.py.
def get_payloads | ( | self | ) |
Get all payloads existing in this file Returns: a sorted list of `PayloadInformation` objects for all payloads defined in this file with the iov set to None
Definition at line 231 of file local_metadata.py.
|
protected |
Cache name->id mappings from the database.
Definition at line 137 of file local_metadata.py.
|
protected |
sqlite Database connection
Definition at line 139 of file local_metadata.py.
|
static |
Application ID to be stored int the sqlite file.
Definition at line 28 of file local_metadata.py.
|
static |
SQL script to create all necessary tables and views.
Definition at line 33 of file local_metadata.py.
|
static |
Schema version, to be increased when the table definitions change so that we can check for safe append operation.
Definition at line 31 of file local_metadata.py.