Project

General

Profile

TestBeam2015DB » History » Version 1

Thomas Stuttard, 08/25/2016 05:16 PM

1 1 Thomas Stuttard
h1. TestBeam2015DB 
2 1 Thomas Stuttard
3 1 Thomas Stuttard
h2. How to connect
4 1 Thomas Stuttard
5 1 Thomas Stuttard
1) Login in to "gm2straw6" as "gm2" user
6 1 Thomas Stuttard
7 1 Thomas Stuttard
2) Connect to DB:
8 1 Thomas Stuttard
9 1 Thomas Stuttard
<pre>
10 1 Thomas Stuttard
mysql --user=gm2user --password=alpha_2pi gm2sc
11 1 Thomas Stuttard
</pre>
12 1 Thomas Stuttard
13 1 Thomas Stuttard
14 1 Thomas Stuttard
h2. Using the DB
15 1 Thomas Stuttard
16 1 Thomas Stuttard
Note that all tables have a *config_id*, which increments at each DB write. Use this to sync between different tables (e.g. all table entries with same config_id are from same DB write, e.g same run).
17 1 Thomas Stuttard
18 1 Thomas Stuttard
List all available data tables (e.g. run data, config data, slow control data, etc):
19 1 Thomas Stuttard
20 1 Thomas Stuttard
<pre>
21 1 Thomas Stuttard
show tables;
22 1 Thomas Stuttard
</pre>
23 1 Thomas Stuttard
24 1 Thomas Stuttard
List all data in a table:
25 1 Thomas Stuttard
26 1 Thomas Stuttard
<pre>
27 1 Thomas Stuttard
select * from <table>;
28 1 Thomas Stuttard
</pre>
29 1 Thomas Stuttard
30 1 Thomas Stuttard
e.g.
31 1 Thomas Stuttard
32 1 Thomas Stuttard
<pre>
33 1 Thomas Stuttard
select * from run;
34 1 Thomas Stuttard
</pre>
35 1 Thomas Stuttard
36 1 Thomas Stuttard
List data columns in a table:
37 1 Thomas Stuttard
38 1 Thomas Stuttard
<pre>
39 1 Thomas Stuttard
show columns from <table>;
40 1 Thomas Stuttard
</pre>
41 1 Thomas Stuttard
42 1 Thomas Stuttard
e.g.
43 1 Thomas Stuttard
44 1 Thomas Stuttard
<pre>
45 1 Thomas Stuttard
show columns from run;
46 1 Thomas Stuttard
</pre>
47 1 Thomas Stuttard
48 1 Thomas Stuttard
List specific columns in table:
49 1 Thomas Stuttard
50 1 Thomas Stuttard
<pre>
51 1 Thomas Stuttard
select <col1,col2,...> from <table>;
52 1 Thomas Stuttard
</pre>
53 1 Thomas Stuttard
54 1 Thomas Stuttard
e.g.
55 1 Thomas Stuttard
56 1 Thomas Stuttard
<pre>
57 1 Thomas Stuttard
select run_number,start_run_comment from run;
58 1 Thomas Stuttard
</pre>
59 1 Thomas Stuttard
60 1 Thomas Stuttard
61 1 Thomas Stuttard
62 1 Thomas Stuttard
h3. Helpful info
63 1 Thomas Stuttard
64 1 Thomas Stuttard
* A handy list of mySQL commands: https://www.pantz.org/software/mysql/mysqlcommands.html
65 1 Thomas Stuttard
66 1 Thomas Stuttard
h3. Useful examples
67 1 Thomas Stuttard
68 1 Thomas Stuttard
Show all start of run comments:
69 1 Thomas Stuttard
70 1 Thomas Stuttard
<pre>
71 1 Thomas Stuttard
select config_id,run_number,start_run_comment from run;
72 1 Thomas Stuttard
</pre>
73 1 Thomas Stuttard
74 1 Thomas Stuttard
75 1 Thomas Stuttard
Show discriminator thresholds:
76 1 Thomas Stuttard
77 1 Thomas Stuttard
<pre>
78 1 Thomas Stuttard
select config_id,lbid,tdcid,name,value from tdcs_config where name = "DTHRThreshold";
79 1 Thomas Stuttard
</pre>