@@ -151,7 +151,7 @@ The quality assessment workflow is based on three columns in the tables:
...
@@ -151,7 +151,7 @@ The quality assessment workflow is based on three columns in the tables:
## Referencing other tables
## Referencing other tables
Data between different tables are connected by id-columns, so called foreign keys. E.g. in the measurements table each measurement of a concentration is referencing a sample in the samples table by the sample_identifier key. Data can only be stored in the database, if all referenced data are already available. This means there is a given order of data import resulting from the data structure.
Data between different tables are connected by id-columns, so called foreign keys. E.g. in the measurements table each measurement of a concentration is referencing a sample in the samples table by the sample_identifier key. Data can only be stored in the database, if all referenced data are already available. This means there is a given order of data import resulting from the data structure:
1. The controlled vocabulary need to be imported by the admins.
1. The controlled vocabulary need to be imported by the admins.
1. Tables only referencing controlled vocabularies can be filled:
1. Tables only referencing controlled vocabularies can be filled:
- data.suppliers
- data.suppliers
...
@@ -179,13 +179,13 @@ Data between different tables are connected by id-columns, so called foreign key
...
@@ -179,13 +179,13 @@ Data between different tables are connected by id-columns, so called foreign key
1. Finally the tables
1. Finally the tables
- xxx.measurements
- xxx.measurements
<details><summary>Technical details on table partitioning and use of composite primary keys</summary>
# Technical aspects not important for basic users
The tables with measurements and samples are using table partitioning in the background to store data from different environmental compartments in different sub tables and thus reduce time for data retrieval. For this reason the compartment column is included in the primary key together with the generated id column.
## Technical details on table partitioning and use of composite primary keys
The tables with measurements and samples are using "table partitioning" in the background to store data from different environmental compartments in different sub tables and thus reduce time for data retrieval. For this reason the compartment column is included in the primary key together with the generated id column.
Furthermore the composite primary key is used to assure, that measurements, samples and sampling sites have always matching compartment information to avoid e.g. a groundwater sample be assigned to a wastewater sampling site.
Furthermore the composite primary key is used to assure, that measurements, samples and sampling sites have always matching compartment information to avoid e.g. a groundwater sample be assigned to a wastewater sampling site.
To allow the compartment to be included twice as foreign key referencing once the compartments table directly and once the compartment as foreign key referencing e.g. the sampling sites compartment from the samples table, generated columns are used to fill the additional columns and check constraints to assure, that the compartment information matches.
To allow the compartment to be included twice as foreign key referencing once the compartments table directly and once the compartment as foreign key referencing e.g. the sampling sites compartment from the samples table, so called "generated columns" are used to fill the additional columns and check constraints to assure, that the compartment information matches.