How to: Work with Templates¶
Most strings/text that is part of your model is treated by CLOE as so called jinja2 templates. Jinja2 is a templating language that allows a wide range of use cases reaching from simple replacing by using a variable:
To very complex scenarios like writing loops to repeat parts or replace parts of your text that is dynamically generated by CLOE(like SQL).
How do I use regex replace?¶
Regex replace has a few pitfalls because regular regex expression are treated as escape sequences by JSON(which CLOE uses to store the model) and render your JSON invalid if not set properly. For this to work properly you need to not only escape the backslash but also escape the escape backslash. Example
This is what you initially want. Search for the first full word character and store it in a capure group("\1"). For this to work properly you need to escape your backslash because otherwise it is interpreted as an escape by JSON.
an now you need to escape both backslashes again for this to work correctly in the CLOE backend:
Real world example of a regex replace in an SQL Template:
Template Artifacts¶
Table Artifacts¶
These can be used for all tables:
| Column Name | Description | Description Artifact |
|---|---|---|
| lu_sink_source_join | list of string artifacts | combined with join operator "\n\t" |
| dq3_log_lu_sink_source_join | list of string artifacts | combined with join operator "\n\t" |
| dq2_view_where | list of string artifacts | combined with OR operator |
| dq2_log_where | list of string artifacts | combined with OR operator |
| dq3_log_where | list of string artifacts | combined with OR operator |
| sink_source_field_comparison | list of string artifacts | combined with OR operator |
| sink_table_identifier | string | |
| source_table_identifier | string | |
| source_insert | list of string artifacts | combined with ",\n\t" operator |
| source_lu_used_columns | list of string artifacts | combined with ",\n\t" operator |
| sink_insert | list of string artifacts | combined with ",\n\t" operator |
| sink_source_update | list of string artifacts | combined with ",\n\t" operator |
| dq1_view_select_as_raw | list of string artifacts | combined with ",\n\t" operator |
| dq2_view_select_as_raw | list of string artifacts | combined with ",\n\t" operator |
| dq3_view_select_as_raw | list of string artifacts | combined with ",\n\t" operator |
| dq1_view_select_as_name | list of string artifacts | combined with ",\n\t" operator |
| dq2_view_select_as_name | list of string artifacts | combined with ",\n\t" operator |
| dq3_view_select_as_name | list of string artifacts | combined with ",\n\t" operator |
| dq1_log_select | list of string artifacts | combined with ",\n\t" operator |
| dq2_log_select | list of string artifacts | combined with ",\n\t" operator |
| lu_source_insert | list of string artifacts | combined with ",\n\t" operator |
| lu_sink_insert | list of string artifacts | combined with ",\n\t" operator |
| lu_sink_source_update | list of string artifacts | combined with ",\n\t" operator |
| dq3_log_select | list of string artifacts | combined with ",\n\t" operator |
Version artifacts¶
These can be retrieved per table.
| Column Name | Description | Description Artifact |
|---|---|---|
| ver_sink_table_identifier | string | |
| ver_source_insert | list of string artifacts | combined with ",\n\t" operator |
| ver_sink_insert | list of string artifacts | combined with ",\n\t" operator |
| ver_sink_source_field_comparison | list of string artifacts | combined with OR operator |
| ver_lu_sink_source_join | list of string artifacts | combined with join operator "\n\t" |