Skip to content
Fabrizio Coccetti edited this page Mar 16, 2015 · 13 revisions

The description of the Run Database is here:

https://github.com/centrofermi/e3pipe/wiki/The-Run-Database

Methods for accessing the db (for developers) are at:

http://dev.mysql.com/doc/connector-python/en/connector-python-example-cursor-select.html

SHOW TABLES;
SHOW COLUMNS from runs;

Queries:

SELECT * FROM runs WHERE station_name = "FRAS-03" AND 
    processing_status_code=0 ORDER BY last_update DESC LIMIT 1;
SELECT * FROM runs WHERE station_name = "FRAS-03" ORDER BY last_update DESC LIMIT 1;

SELECT COUNT(*) FROM runs 
    WHERE station_name = 'CAGL-01' 
    AND transfer_timestamp BETWEEN '2015-02-24 00:00:00' AND '2015-02-24 23:59:59';

Summary queries:

Number of runs:

SELECT COUNT(*) from runs;

Number of runs since start of Run1:

SELECT station_name, COUNT(*) from runs WHERE run_date >= '2015-02-23' GROUP BY station_name;

Number of good tracks:

SELECT SUM(num_track_events) from runs;
SELECT SUM(num_track_events) from runs WHERE run_date >= '2015-02-23';

Number of files transferred per day by each station:

SELECT station_name, run_date, COUNT(*) from runs WHERE (run_date >= '2015-02-23' AND run_date <= '2015-03-15') GROUP BY station_name, run_date;

Number of files transferred per day by a specific statio:

SELECT station_name, run_date, COUNT(*) from runs WHERE (run_date >= '2015-02-23' AND run_date <= '2015-03-16') AND (station_name = 'BOLO-01') GROUP BY station_name, run_date;

Clone this wiki locally