Skip to content

Python Low Level API

Collinm8 edited this page Jun 11, 2019 · 12 revisions

Low Level Python API

Low level python API allows one to work with CCDB using python objects. So the code looks like this:

    # read directory
    directory = provider.get_directory("/test/test_vars")
    print directory.name           # Name of this directory
    print directory.path           # Full path

    for table in directory.type_tables:
        print table.path
        print " ".join([column.name for column in table.columns])
    
    table = provider.get_type_table("/test/test_vars/test_table2")
    #...

Examples

Read all kinds of data from CCDB:
$CCDB_HOME/python/example_llapi_readout.py

Read constants, change value and save them back:
$CCDB_HOME/python/example_llapi_change_value.py

Some example of how to add data is here:
$CCDB_HOME/python/example_llapi_add_custom_data.py

Example how to manage variations (create, read, update, delete):
$CCDB_HOME/python/example_llapi_variations.py

More examples (or like examples) could be seen in unit tests. Modification and deletion is ther. Please see:
$CCDB_HOME/python/tests/provider_fixture.py

Classes and functions

The data model (where you can see class fields and read comments) is at $CCDB_HOME/python/ccdb/model.py

The API functions are collected in provider class. You can see them here: $CCDB_HOME/python/ccdb/provider.py

(Links follow to GitHub pages of the files)

get_assignment_by_request