-
Notifications
You must be signed in to change notification settings - Fork 7
Select runs and get values
Dmitry Romanov edited this page Mar 17, 2016
·
23 revisions
To experiment with the examples of this page one can download daily recreated SQLite database: https://halldweb.jlab.org/dist/rcdb.sqlite
Using connection string:
sqlite:///<path to file>/rcdb.sqlite
Or connect to readonly mysql:
mysql://[email protected]/rcdb
Supposing one wants to get all event_count-s and beam_current-s for production runs:
import rcdb
db = rcdb.RCDBProvider("mysql://[email protected]/rcdb")
table = rcdb.select_runs("@is_production").get_values(['event_count', 'beam_current'], insert_run_number=True)
print table
As the result one gets something like:
[
[1023, 3984793, 0.145]
[1024, 4569873, 0.230]
...
]
Where the first column is a run number (we set insert_run_number=True
above), and other columns are the conditions in the order we gave them.
If one wants to apply a run range, say for a particular run period:
table = rcdb.select_runs("@is_production", run_min=10000, run_max=20000)\
.get_values(['event_count', 'beam_current'], insert_run_number=True)
To get values for all runs without filtration a search pattern may be skipped:
table = rcdb.select_runs(run_min=10000, run_max=20000)\
.get_values(['event_count', 'beam_current'], insert_run_number=True)
(note that we use parameter names so that python could figure them out)
Getting started & basic usage:
- Installation
- Select values tutorial (python)
- Query syntax
- Add data (python)
- CLI Basics
RCDB Explained:
- Connection
- DB and APIs structure
- SQL examples
- Creating condition types
- Adding condition values
- Saving files
- SQLAlchemy
- Logging
- Performance
Command line tools:
DAQ: