Replies: 3 comments 1 reply
-
@ponceta Please review - then I can integrate in https://github.com/teksi/Home/wiki/TEKSI-Developer-Guide |
Beta Was this translation helpful? Give feedback.
0 replies
-
Schemas
If we face a situation which enforce this I would be happy to add a custom schema. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My suggestions concerning custom database extensions are the following:
Schemas
TEKSI datamodels are organized with different schemas simplifying comprehension, rights management and development.
[...]
Tables
[...]
If a custom database extension introduces new tables with ordinary data, these must be marked with the prefix of the database extension. The beforementioned rules for Tables apply.
Field naming conventions
to define
TEKSI distinguishes the following field names:
no prefix
tww_od.wastewater_structure._usage_current
). Updated by triggers.prefix: '_'
tww_vl.channel_function_hierarchic.cfg_order_fct_hierarchic
)suggested prefix: 'cfg_'
suggested prefix: 'txx_'
suggested prefix: 'custom_', custom being any extension name (ex. tdw_sire -> sire) for any extension need
[...]
Loading of database extensions
In order to facilitate loading database extensions, there is a default solution implemented in https://github.com/teksi/wastewater (introduced in Pull Request 300
In *datamodel\extensions* there is a prepared python script that can be called from the shell using
python datamodel\extensions\extension_manager.py --pg_service %myservice% --srid 2056 --drop-schema --extension_name demo
.In *datamodel\extensions* there is a yaml holding the key informations for creation (id, directory name, schema name and variables) for the extension. The code then sorts all the files in the directory defined in the yaml and executes all .sql and .py scripts in that folder.
Value list
[...]
TEKSI wastewater: These value lists are defined in the VSA-DSS datamodel. Do not change!
If new Columns in form custom database extensions require new value lists, these are added into txx_vl in analogy to the regular value lists. The naming of the new value lists includes the extension prefix, i.e. a value list extension for
tww_od.wastewater_node.ag96_is_gateway
is handled intww_vl.wastewater_node_ag96_is_gateway
. Make sure to inherit fromtxx_vl.value_list_base
Adding entries to existing value lists
Value list extensions from custom database extensions must be provided with a new code that is not already contained in
txx_sys.dictionary_od_field.attribute_id
. The index must be unique across all value lists. In addition, each value list extension must be mapped with an original value via the vsacode (todo: is vsacode the correct naming here). Unused values from the base model are not deleted, but the attributeactive
is set toFALSE
instead. See the example from tww_ag6496 below:[...]
Relational mapping
When creating a database extension, there might arise the necessity to define 1:1 attribute mappings for import. These value lists are handled by inheriting from a base value list. In the following example, we want to map both
tww_od.manhole.function
values8736
(manhole) and9302
(combined_manhole) to the value "Kontrollschacht" in german. Import values "Kontrollschacht" are to be mapped to8736
.First we create the value list base tables for import and export
From these base tables we inherit the setup of the specialised tables
For the export mapping, we use
Views
ALL official views referencing txx_od are created in the txx_app schema.
Scripts are stored in the
datamodel/view
folder. The corresponding scripts should be named accordingly (.sql
,.yaml
,.py
).Naming convention :
vw_maintenance
)swmm_vw_conduits
)txx_custom
(Note: This separation from tww_app facilitates setting up specific views for interlis exports, where txx_custom can serve as a txx_od substitute. Also, txx_app is re-created on datamodel updates)Warning :
We strongly discourage users to create views referencing other views. This can lead to overly complicated upgrades when dealing with datamodel alterations (postgreSQL locks).
Functions
Functions of custom database extensions are stored in the application schema of the extension
txx_custom
Triggers
Trigger functions of custom database extensions are stored in the application schema of the extension
txx_custom
Beta Was this translation helpful? Give feedback.
All reactions