SQL-Datenmodell

Overview

Overview over the DDS Datamodel

Table Details

All timestamps are stored as BIGINT as milliseconds since Unix epoch, are mapped to Java java.time.Instant.

Table dds_user

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
create_tsBIGINT NOT NULLInstant
domainVARCHAR(255) NOT NULLString
user_idVARCHAR(255)String
given_nameVARCHAR(255)String
sur_nameVARCHAR(255)String
emailVARCHAR(255)String

Table dds_user_group

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
ad_group_idVARCHAR(255) NOT NULL UNIQUEString
dds_nameVARCHAR(255) NOT NULL UNIQUEString

Table dds_user_group_permission

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
group_idBIGINT NOT NULL REFERENCES dds_user_group(id)Long
right_idBIGINT NOT NULL REFERENCES dds_user_right(id)Long
data_source_idBIGINT REFERENCES dds_datasource(id)Longnull means all datasources
max_confidentialityVARCHAR(255)Stringnull means all confidentialies

Table dds_user_right

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
actVARCHAR(255)String
technical_keyVARCHAR(255)String

Table dds_schema

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
descriptionVARCHAR(255) NOT NULLString
long_name_patternVARCHAR(255) NOT NULLString
long_name_annotations_patternVARCHAR(255) NOT NULLString
short_name_patternVARCHAR(255) NOT NULLString

Table dds_schema_prop

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
typeVARCHAR(255) NOT NULLString
json_nameVARCHAR(255) NOT NULL UNIQUEString
importanceVARCHAR(255) NOT NULLString
labelVARCHAR(255) NOT NULL UNIQUEString
descriptionVARCHAR(4096)String
true_nameVARCHAR(255)String
false_nameVARCHAR(255)String
editableBOOLEAN NOT NULLBoolean
searchableBOOLEAN NOT NULLBoolean
priorityINTEGER NOT NULLInteger
entity_typeVARCHAR(32) NOT NULLString
other_range_boundBIGINT REFERENCES dds_schema_prop(id)Long
range_startBOOLEANBoolean
requiredBOOLEAN NOT NULLBoolean
for_exportBOOLEAN NOT NULLBooleanWhether this property will be included in the export metadata

Table dds_schema_schema_prop

ColumnDatabase TypeJava TypeRemarks
schema_prop_idBIGINT NOT NULL PRIMARY KEY REFERENCES dds_schema_prop(id)Long
schema_idBIGINT NOT NULL PRIMARY KEY REFERENCES dds_schema(id)Long

Table dds_enum_value

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
schema_prop_idBIGINT NOT NULL REFERENCES dds_schema_prop(id)Long
valueVARCHAR(255) NOT NULLString
descriptionVARCHAR(1024)String

Table dds_datasource

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
data_point_schema_idBIGINT NOT NULL REFERENCES dds_schema(id)Long
data_variant_schema_idBIGINT NOT NULL REFERENCES dds_schema(id)Long
short_nameVARCHAR(255) NOT NULL UNIQUEString
long_nameVARCHAR(1024) NOT NULLString
long_descriptionVARCHAR(4096)String
database_typeVARCHAR(255)String
database_connectionVARCHAR(255)String
table_nameVARCHAR(1024)String
user_read_permissionVARCHAR(255)String
schemasVARCHAR(255)String
time_descriptionVARCHAR(255)String
analysis_time_windowVARCHAR(255)String
null_interpretationVARCHAR(255)String
preview_limitBIGINTLong
export_block_sizeINTEGERInteger
further_information_linkVARCHAR(255)String
inbound_outboundVARCHAR(255)String
privacy_informationVARCHAR(4096)String
deputy_emailVARCHAR(80) NOT NULLString
datapoint_creation_methodVARCHAR(16)String
propsJSONB NOT NULLat.iteg.dds.api.dto.DdsDatasourcePropsUsing json here would not have been my first choice but it seems to lead to the best outcome.
Evaluated alternatives:
- postgresql table inheritance: not chosen because indices, unique indices, and primary keys do not carry over
across different sub-tables which would prevent us from having a foreign key to the datasource.
- inheritance by using a central id and sub-tables having a foreign key to the central table:
Not chosen because the amount of code to map this structure to java classes would be quite large
and would probably have to be repeated for every datasource type that we decide to add.
- Simply having every property on dds_datasource: Zero separation of concerns,
Makes it hard to attribute properties to datasource types which might lead to datasource types
using properties that should not actually be defined for them, Unclear nullability.

In the end using json allows to define the properties
that are allowed for a datasource type in code and make it all type-safe.
export_column_descriptionVARCHAR(4096)String

Table dds_dirty_flags

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongid is dbType SERIAL by migration
create_tsBIGINT NOT NULLInstantcreate_ts is dbType timestamp by migration
dirty_flagVARCHAR(10) NOT NULLString
contextVARCHAR(255) NOT NULLString

Table dds_data_point

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
import_propsJSONB NOT NULLjava.util.Map<String, Object>JSON object containing all attributes imported from the foreign database system.
user_propsJSONBjava.util.Map<String, java.util.Optional<Object>>JSON object containing all attributes entered by the user.
null values mean that the property is explicitly empty
import_props_hashBYTEA NOT NULLbyte[]
createdBIGINT NOT NULLInstant
created_byBIGINT NOT NULL REFERENCES dds_user(id)Long
updatedBIGINTInstant
updated_byBIGINT REFERENCES dds_user(id)Long
invalidatedBIGINTInstant
invalidated_byBIGINT REFERENCES dds_user(id)Long
datasource_idBIGINT NOT NULL REFERENCES dds_datasource(id)Long
primary_propVARCHAR(255) NOT NULLStringThe identifier(s) in the foreign database.
Is unique in combination with the datasource_id
confidentialityVARCHAR(2) NOT NULLString
merged_propsJSONB NOT NULLjava.util.Map<String, Object>The generated combination of import_props and user_props.
Entries in user_props override entries in imports_props.
fulltext_keyVARCHAR(255) NOT NULLStringCommented out because we cannot do anything with this column because of its type.

Table dds_data_variant

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
createdBIGINT NOT NULLInstantThe timestamp when this entity was created.
created_byBIGINT NOT NULL REFERENCES dds_user(id)LongThe user this entity was created by.
updatedBIGINTInstantThe timestamp when this entity was last update.
updated_byBIGINT REFERENCES dds_user(id)LongThe user this entity was last updated by.
invalidatedBIGINTInstantThe timestamp of this entities deletion (Soft-delete)
invalidated_byBIGINT REFERENCES dds_user(id)LongThe user this entity was deleted by.
import_propsJSONB NOT NULLjava.util.Map<String, Object>JSON object containing all attributes imported from the foreign database system.
user_propsJSONBjava.util.Map<String, java.util.Optional<Object>>JSON object containing all attributes entered by the user.
null values mean that the property is explicitly empty
import_props_hashBYTEA NOT NULLbyte[]A cryptographic hash of the import_props.
Calculated using a procedure that ignores the order of the props.
Used for change detection
data_point_idBIGINT NOT NULL REFERENCES dds_data_point(id)Long
primary_propVARCHAR(255) NOT NULLStringThe identifier(s) in the foreign database.
Is unique in combination with the datasource_id of the corresponding datapoint.
merged_propsJSONB NOT NULLjava.util.Map<String, Object>The generated combination of import_props and user_props.
Entries in user_props override entries in imports_props.

Table dds_data_fetch_statistic

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
fetch_period_nsBIGINTLongTODO Nullable + Index anschauen; Reihenfolge im Index wichtig!
fetch_fromBIGINTInstant
fetch_toBIGINTInstant
createdBIGINT NOT NULLInstant
data_variant_idBIGINT NOT NULL REFERENCES dds_data_variant(id)Long
start_up_time_nsBIGINT NOT NULLLong
fetch_time_nsBIGINT NOT NULLLong
job_idBIGINTLongno foreignKey to keep statistics when deleting job
job_run_idBIGINTLongno foreignKey to keep statistics when deleting jobRun
template_idBIGINTLongno foreignKey to keep statistics when deleting template
result_limitBIGINTLong
result_fromBIGINTInstant
result_toBIGINTInstant
result_countBIGINTLong

Table dds_unit

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
unitVARCHAR(64) NOT NULLString
descriptionVARCHAR(1024)String
dimensionVARCHAR(255) NOT NULLString
is_standardBOOLEAN NOT NULLBooleanTrue = Standardeinheit (wie in Referenzdatenbank);
False = Einheit aus Quelldatenbank (wenn Importer es erlaubt, Importer können Quelldatenbank-Einheiten
auf nicht vorhanden abbilden, oder durchlassen; an der GUI (Admin/Einheiten) "Importiert"

Table dds_unit_mapping

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
keyVARCHAR(255) NOT NULLString
valueVARCHAR(255) NOT NULLString
convertion_formulaVARCHAR(255)String
datasource_idBIGINT REFERENCES dds_datasource(id)Long

Table dds_ksv

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
deletedBOOLEAN NOT NULLBoolean
releasedBOOLEAN NOT NULLBoolean
parent_idBIGINT REFERENCES dds_ksv(id)LongIf parent_id is null this ksv node is at the root
deferred during the ksv import
codeVARCHAR(80) NOT NULL UNIQUEString
nameVARCHAR(255) NOT NULLString
fulltext_keyVARCHAR(255) NOT NULLString
full_pathBIGINT[] NOT NULLLong[]The entire list of ancestors including ourselves.
[root,level1,level2,...,self]
leafBOOLEAN NOT NULLBooleantrue if this node doesn't have any children

Table dds_tag

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
labelVARCHAR(255) NOT NULL UNIQUEString
descriptionVARCHAR(255) NOT NULLString
createdBIGINT NOT NULLInstant
created_byBIGINT NOT NULL REFERENCES dds_user(id)Long
updatedBIGINTInstant
updated_byBIGINT REFERENCES dds_user(id)Long

Table dds_template_module_to_datasource

datasource filter

ColumnDatabase TypeJava TypeRemarks
datasource_idBIGINT NOT NULL PRIMARY KEY REFERENCES dds_datasource(id)Long
template_module_idBIGINT NOT NULL PRIMARY KEY REFERENCES dds_template_module(id)Long

Table dds_template_module

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
nameVARCHAR(255) NOT NULL UNIQUEString
descriptionVARCHAR(1024)String
is_privateBOOLEAN NOT NULLBoolean
search_termVARCHAR(255)String
activity_filterVARCHAR(32)String
chart_configurationJSONBat.iteg.dds.api.dto.chartconfig.DbChartConfiguration
betriebs_berichte_enabledBOOLEAN NOT NULLBoolean
betriebs_berichte_ksv_filterVARCHAR(255)StringThe betriebsberichte ksv filter and the search ksv filter are treated as an entirely different thing on the backend
The fontend assumes and ensures that they are both the same thing
This is a bit weird, but it simplifies many things
betriebs_berichte_description_filterVARCHAR(255)String
betriebs_berichte_reason_filterTEXT[]String[]
include_annotationsBOOLEAN NOT NULLBoolean
createdBIGINT NOT NULLInstant
created_byBIGINT NOT NULL REFERENCES dds_user(id)Long
updatedBIGINTInstant
updated_byBIGINT REFERENCES dds_user(id)Long

Table dds_search_filter

One of the filters in a template module.

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
template_module_idBIGINT NOT NULL REFERENCES dds_template_module(id)Long
entity_typeVARCHAR(32) NOT NULLStringThe type of entity this filter acts on.
Can be data_point or data_variant
schema_prop_idBIGINT NOT NULL REFERENCES dds_schema_prop(id)LongThe property that this filter filters.
typeVARCHAR(32) NOT NULLStringThe filter operator
Can be EQUAL, LESS_THAN, LESS_OR_EQUAL, GREATER_THAN, GREATER_OR_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, IN, UNDEF, or LIKE
valueJSONBObjectThe operator value
The meaning of this attribute changes depending on the operator type

Table dds_template

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
nameVARCHAR(255) NOT NULL UNIQUEString
descriptionVARCHAR(1024)String
notesVARCHAR(4096)String
visibilityVARCHAR(32)String
default_periodVARCHAR(16) NOT NULLStringDefault value of defaultPeriod is 'daily'
createdBIGINT NOT NULLInstant
created_byBIGINT NOT NULL REFERENCES dds_user(id)Long
updatedBIGINTInstant
updated_byBIGINT REFERENCES dds_user(id)Long

Table dds_template_module_to_template

ColumnDatabase TypeJava TypeRemarks
template_idBIGINT NOT NULL PRIMARY KEY REFERENCES dds_template(id)Long
template_module_idBIGINT NOT NULL PRIMARY KEY REFERENCES dds_template_module(id)Long

Table dds_tag_to_template

ColumnDatabase TypeJava TypeRemarks
template_idBIGINT NOT NULL PRIMARY KEY REFERENCES dds_template(id)Long
tag_idBIGINT NOT NULL PRIMARY KEY REFERENCES dds_tag(id)Long

Table dds_template_module_to_data_variant

selected variants

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
data_variant_idBIGINT NOT NULL REFERENCES dds_data_variant(id)Long
template_module_idBIGINT NOT NULL REFERENCES dds_template_module(id)Long
descriptionVARCHAR(256)String

Table dds_template_job

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
createdBIGINT NOT NULLInstantThe timestamp when this entity was created.
created_byBIGINT NOT NULL REFERENCES dds_user(id)LongThe user this entity was created by.
updatedBIGINTInstantThe timestamp when this entity was last update.
updated_byBIGINT REFERENCES dds_user(id)LongThe user this entity was last updated by.
invalidatedBIGINTInstantThe timestamp of this entities deletion (Soft-delete)
invalidated_byBIGINT REFERENCES dds_user(id)LongThe user this entity was deleted by.
nameVARCHAR(255) NOT NULL UNIQUEString
template_idBIGINT NOT NULL REFERENCES dds_template(id)Long
descriptionVARCHAR(4096)String
is_draftBOOLEAN NOT NULLBoolean
is_in_health_checkBOOLEAN NOT NULLBoolean
export_target_idBIGINT NOT NULL REFERENCES dds_export_target(id)Long
notification_emailsVARCHAR(1023)String
activatedBIGINTInstantThe user that activated this job.
Used for the authorization of export variants using dds_template_job_activation_group
activated_byBIGINT REFERENCES dds_user(id)Long
start_boundary_timestampBIGINT NOT NULLInstantIn UTC
start_boundary_timezoneVARCHAR(32) NOT NULLString
integrity_durationBIGINT NOT NULLInstant
periodVARCHAR(32) NOT NULLString
retry_delayINTEGERIntegerseconds
retry_timeoutBIGINTLongseconds
retry_max_countINTEGERInteger

Table dds_template_job_activation_group

The groups of the activatedBy user at the point in time where they activated it. Storing these prevents us from needing to fetch the groups of a user that is not logged in and prevents the export job from failing if the activating user priviledges are reduced by, for example, them leaving the company.

ColumnDatabase TypeJava TypeRemarks
template_job_idBIGINT NOT NULL PRIMARY KEY REFERENCES dds_template_job(id)Long
user_group_idBIGINT NOT NULL PRIMARY KEY REFERENCES dds_user_group(id)Long

Table dds_job_run

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
job_idBIGINT NOT NULL REFERENCES dds_template_job(id)LongThe ID of the Template/ExportJob
run_tsBIGINT NOT NULLInstantWhen this job run SHOULD run, e.g. now or at x o'clock on y date, depending on start
uuidVARCHAR(255)StringThe unique schedule UUID, i.e. the ID it is registered in the OneTimeScheduler
run_started_tsBIGINTInstantWhat time the (last) attempt was started (transition time for state RUNNING)
run_finished_tsBIGINTInstantThe last attempt's (final/error) state transition time
from_tsBIGINTInstantDateTime from where data is fetched
to_tsBIGINTInstantDateTime to where data is fetched
iterationINTEGERIntegerUnused; idea was to store the auto-schedule iteration.
By that one knows whether this was an automatic scheduled job run or adhoc.
Currently, it is never set.
attemptINTEGER NOT NULLIntegerIf there was an error, which attempt is scheduled?
statusVARCHAR(16) NOT NULLStringStatemachine status
result_countBIGINTLongIf SUCCESS, how many elements were fetched (in sum)
is_periodicallyBOOLEAN NOT NULLBooleanWhether this job run was started as periodically scheduled (false: called adhoc)
started_byBIGINTLongThe numeric ID of the user who scheduled this job

Table dds_export_target

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
nameVARCHAR(255) NOT NULLStringThere is an XOR constraint on schemaName and filePath (only and exactly one may exist) (dds_export_target_schema_name_check_xor_file_path)
There is a UNIQUE constraint on name (dds_export_target_unique_name)
There is a ENUM constraint on confidentiality (dds_export_target_check_confidentiality)
schema_nameVARCHAR(40)String
file_pathVARCHAR(255)String
confidentialityVARCHAR(2) NOT NULLString
default_csv_formatBIGINT REFERENCES dds_csv_export_format(id)Long
export_dbVARCHAR(32)String

Table dds_csv_export_format

The csv export options.

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
media_typeVARCHAR(255)StringThe media type, always text/csv;charset=utf-8
delimiterVARCHAR(1)StringThe csv options according to commons-csv CSVFormatopen in new window
record_separatorVARCHAR(255)String
quoteVARCHAR(1)String
escape_characterVARCHAR(1)String
decimal_separatorVARCHAR(1)String
date_time_formatVARCHAR(255)StringThe datetime format string according to DateTimeFormatteropen in new window.
timezoneVARCHAR(255)StringThe iana timezone id that will be used for all output dates.
Offset specifications strings like those used by ZoneOffsetopen in new window
shouldn't be used because they lack good interoperability between datetime libraries
datavariant_layoutVARCHAR(255)Stringvertical or horizontal

Table dds_tag_to_datapoint

ColumnDatabase TypeJava TypeRemarks
idBIGINT NOT NULL PRIMARY KEYLongThe primary key
tag_idBIGINT NOT NULL REFERENCES dds_tag(id)Long
data_point_idBIGINT NOT NULL REFERENCES dds_data_point(id)Long