ConditionsDbSchema: Difference between revisions

From Mu2eWiki
Jump to navigation Jump to search
Line 26: Line 26:
|}
|}


in the database definition, this table needs to hold many calibration and we need a way to separate them, so we add a column call ''cid'', which stands for '''calibration ID'''.  So the actual database table look like the following, with two calibrations entered, with cids of 1 and 2.
in the database definition, this table needs to hold many calibration and we need a way to separate them, so we add a column call ''cid'', which stands for '''calibration ID'''.  One cid number is unique across the whole database, so it labels exactly three rows in exactly this table. The actual database table look like the following, with two calibrations entered, with cids of 1 and 2.


{| class="wikitable"
{| class="wikitable"
Line 50: Line 50:
| 3.11
| 3.11
|-
|-
| 1
| 2
| 0
| 0
| 22
| 22
| 1.21
| 1.21
|-
|-
| 1
| 2
| 1
| 1
| 23
| 23
| 2.21
| 2.21
|-
|-
| 1
| 2
| 2
| 2
| 21
| 21

Revision as of 22:19, 24 October 2018

Introduction

A database schema is the design of the tables and functions, etc, and their interactions. Here we describe the conditions database in some detail.

We are using postgres databases. In postgres, the word "schema" is also used to refer to a what is essentially a folder, or a way to group database tables and assign permssions as a group. We have several of this type of schema, one for each detector subsystem (trk,cal,crv) plus one for the interval of validity structure (val) and one for test tables (tst). A table can be referred to as schema.name, for example, we have an example table in the tst schema, tst.calib1.

Lower Level

Starting with tst.calib1, we have a conceptual content like:

channel flag DtoE
0 12 1.11
1 13 2.11
2 11 3.11

in the database definition, this table needs to hold many calibration and we need a way to separate them, so we add a column call cid, which stands for calibration ID. One cid number is unique across the whole database, so it labels exactly three rows in exactly this table. The actual database table look like the following, with two calibrations entered, with cids of 1 and 2.

cid channel flag DtoE
1 0 12 1.11
1 1 13 2.11
1 2 11 3.11
2 0 22 1.21
2 1 23 2.21
2 2 21 3.21

Upper Level