...
The block function is used to render the contents of a block tag more than once.
Example |
{% block "testBlock" %}Some content
{% endblock %}
{{ block("testBlock") }}
|
Output |
Some contentSome content
|
...
The parent function is used inside of a block to render the content that the parent template would have rendered inside of the block had the current template not overriden it.
Template |
{% block "${blockName}" %}
{{ parent() }}
{% endblock %}
|
range
The range function will return a list containing an arithmetic progression of numbers.
...
The combineLists function will return a merged list of the two arguments.
Example |
{% set listA = [ "a", "b", "c" ] %} {% set listB = [ "d", "c", "e" ] %} {{ combineLists(false, listA, listB) }} {{ combineLists(true, listA, listB) }}
|
Output
|
[a, b, c, d, c, e][a, b, c, d, e]
|
...
The closestConnection function will return a Connection that is the closest when traversing the source mappings.
Template |
{% set ${graphs} = closestConnection(table) %}
|
Anchor |
---|
| _createsourcegraph(table_table,_boolean_ |
---|
| _createsourcegraph(table_table,_boolean_ |
---|
|
createSourceGraph(Table table, boolean style, boolean denormalize)
...
- QueryGraph.rootTables - If denormalize is true this contains the original table and all directly related tables, otherwise it only contains the original table.
- QueryTable.tables - Contains a list of source tables to generate the query over.
- QueryTable.connection - The associated connection for the set of source tables.
Template |
{% set ${graphs} = createSourceGraph(table, ${style}, ${denormalize}) %}
|
Anchor |
---|
| _createsourcegraphbyset(table_table,_str |
---|
| _createsourcegraphbyset(table_table,_str |
---|
|
createSourceGraphBySet(Table table, String sourceSetName, boolean style, boolean denormalize)The createSourceGraphBySet function will return a list of QueryGraphs, one for each source connection, containing the tables for a query by the given source set.
The style flag is set to true for calculating a data query or false for a data warehouse query.
The denormalize flag determines whether to calculate a query with any related tables to the provided table.
- QueryGraph.rootTables - If denormalize is true this contains the original table and all directly related tables, otherwise it only contains the original table.
- QueryTable.tables - Contains a list of source tables to generate the query over.
- QueryTable.connection - The associated connection for the set of source tables.
Template |
{% set ${graphs} = createSourceGraphBySet(table, ${sourceSet}, ${style}, ${denormalize}) %}
|
Anchor |
---|
| _getprofilingvalues(table/column/relatio |
---|
| _getprofilingvalues(table/column/relatio |
---|
|
getProfilingValues(Table/Column/Relation obj, String metric, boolean casing)The getProfilingValues function will return a list of all the values for the specified profiling metric name on a given object.
Example |
{%- for col in table.columns -%}
{%- if col.name == "City" -%}
{%- set pv = getProfilingValues(col,"Avg character count",true) -%}
|
...
Avg character count: {{pv[0].snd}}{%br%}
{%- endif -%}
{%- endfor -%}
|
Output |
Avg character count: 8
|
Example 2 |
{%- for col in table.columns -%}
{%- if col.name == "CategoryID" -%}
{%- set pv=getProfilingValues(col,"AVG Value",false) -%}
Avg value: {{pv[0].snd}}{
|
...
%br%}
{%- endif -%}
{%- endfor -%}
|
Output |
Avg
|
...
...
3 |
{%- for col in table.columns -%}
{%- if col.name == "
|
...
City" -%}
{%- set pv = getProfilingValues(col,"
|
...
...
...
...
Distinct value count: {{pv[0].snd}}{
|
...
%br%}
{%- endif -%}
{%- endfor -%}
|
Output |
...
...
...
4 |
{%- for col in table.columns -%}
{%- if col.name == "City" -%}
{%- set pv = getProfilingValues(col,"
|
...
Max character count",true) -%}
|
...
Max character count: {{pv[0].snd}}{
|
...
%br%}
{%- endif -%}
{%- endfor -%}
|
Output |
...
...
...
5 |
{%- for col in table.columns -%} {%- if col.name == "City" -%} {%- set pv = getProfilingValues(col,"Max
|
...
trimmed length",true) -%}
|
...
Max trimmed length: {{pv[0].snd}}{
|
...
%br%} {%- endif -%} {%- endfor -%}
|
Output |
Max
|
...
...
...
6 |
{%- for col in table.columns -%}
|
...
...
...
name == "City" -%} {%- set pv = getProfilingValues(col,"
|
...
Min character count",true) -%}
|
...
Min character count: {{pv[0].snd}}{
|
...
%br%} {%- endif -%} {%- endfor -%}
|
Output |
...
Max trimmed length: 15
...
7 |
{%- for col in table.columns -%} {%- if col.name == "
|
...
Region" -%} {%- set pv = getProfilingValues(col,"
|
...
...
Percentage Null: {{pv[0].snd}}{
|
...
%br%} {%- endif -%} {%- endfor -%}
|
Output |
...
Avg character count: 4
...
8 |
{%- for col in table.columns -%} {%- if col.name == "Region" -%} {%- set pv = getProfilingValues(col,"Null
|
...
...
Null count: {{pv[0].snd}}{
|
...
%br%} {%- endif -%} {%- endfor -%}
|
Output |
...
...
...
9 |
{%- for col in table.columns -%} {%- if col.name == "
|
...
CategoryID" -%} {%- set pv = getProfilingValues(col,"
|
...
...
Numeric range: {{pv[0].snd}}{%br%} {%- endif -%} {%- endfor -%}
|
Output |
...
Null count: 60
...
10 |
{%- for col in table.columns -%} {%- if col.name == "
|
...
Region %" -%} {%- set pv = getProfilingValues(col,"
|
...
...
Percentage populated: {{pv[0].snd}}{
|
...
%br%} {%- endif -%} {%- endfor -%}
|
Output |
...
Percentage Populated: 34.07%
|
...
11 |
{%- for col in table.columns -%}
{%- if col.name == "Region
|
...
" -%}
{%- set pv = getProfilingValues(col,"Populated count",true) -%}
|
...
Populated count: {{pv[0].snd}}{%br%}
{%- endif -%}
{%- endfor -%}
|
Output |
Populated count: 31
|
...
Output
...
Percentage Populated: 34.07%
...
Example 11
...
Example 12 |
{%- for col in table.columns -%}
{%- if col.name == "CategoryID" -%}
{%- set pv = getProfilingValues(col,"Sum value",true) -%}
Sum value: {{pv[0].snd}}{%br
|
...
...
...
endfor -%}
|
Output |
Sum value: 36.0
|
Example 13 |
{%- for col in table.columns -%}
|
...
{%- if col.name == "City" -%}
{%- set pv = getProfilingValues(col,"Top 10 most frequent values",true) -%}
Top 10 most frequent values:{%br%}
{%- for v in pv -%}
{{loop.index + 1}}- {{v.fst}}: {{v.snd}}{%br%}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
|
Output |
...
Populated count: 31
...
Example 12
...
Top 10 most frequent values
1- London: 6
2- México D.F.: 5
3- Sao Paulo: 4
4- Rio de Janeiro: 3
5- Madrid: 3
6- Buenos Aires: 3
7- Paris: 2
8- Portland: 2
9- Nantes: 2
10- Lisboa: 2
|
Example 14 |
{%- for col in table.columns -%} {%- if col.name == "CategoryID" -%} {%- set pv = getProfilingValues(col,"Min value",true) -%} Min value: {{pv[0].snd}}{
|
...
%br%} {%- endif -%} {%- endfor -%}
|
Output |
...
...
...
Example 13
Example 15 |
{%- for col in table.columns -%} {%- if col.name == "
|
...
CategoryID" -%} {%- set pv = getProfilingValues(col,"
|
...
...
Output
...
Top 10 most frequent values
1- London: 6
2- México D.F.: 5
3- Sao Paulo: 4
4- Rio de Janeiro: 3
5- Madrid: 3
6- Buenos Aires: 3
7- Paris: 2
8- Portland: 2
9- Nantes: 2
10- Lisboa: 2
Example 14 |
{%- for col in table.columns -%} {%- if col.name == "CategoryID" -%} {%- set pv = getProfilingValues(col,"Min value",true) -%} <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="9fb7e549-658b-4fdb-9261-a3d9314fda29"><ac:plain-text-body><![CDATA[ Min value: pv[0].snd {%br%} ]]></ac:plain-text-body></ac:structured-macro> {%- endif -%} {%- endfor -%} |
Output |
Min value: 1 |
Example 15 |
{%- for col in table.columns -%} {%- if col.name == "CategoryID" -%} {%- set pv = getProfilingValues(col,"Max value",true) -%} <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="5702a3bb-4a7e-42a9-b220-155a57ddb7a2"><ac:plain-text-body><![CDATA[ Max value: pv[0].snd {%br%} ]]></ac:plain-text-body></ac:structured-macro> {%- endif -%} {%- endfor -%} |
Output |
Max value: 8 |
...
Template |
{% set ${mapping} = mapDuplicateAlias( ${tables}, %{queryTables}) %} |
...
Template |
{% set ${parsed} = parseQuery( ${query}) %} |
...
Template
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2799eab9-8486-4913-9554-f7039108aad4"><ac:plain-text-body><![CDATA[
...
{{ quote("SELECT * FROM `TUTORIAL`.`CUSTOMER`;", "[", "]") }}
...
]]></ac:plain-text-body></ac:structured-macro>
...
Output
Max value: {{pv[0].snd}}{%br%} {%- endif -%} {%- endfor -%}
|
Output |
Max value: 8
|
Anchor |
---|
| _mapduplicatealias(list<table>_tables,_l |
---|
| _mapduplicatealias(list<table>_tables,_l |
---|
|
mapDuplicateAlias(List<Table> tables, List<QueryTable> queryTables)The mapDuplicateAlias function returns a mapping from source table aliases to root tables in the tables list with multiple aliases in the queryTables list.
Template |
{% set ${mapping} = mapDuplicateAlias( ${tables}, %{queryTables}) %}
|
Anchor |
---|
| _parsequery(string_query) |
---|
| _parsequery(string_query) |
---|
|
parseQuery(String query)The parseQuery function will parse a query String into a QueryDefinition object.
Template |
{% set ${parsed} = parseQuery( ${query}) %}
|
Anchor |
---|
| _quote(string_query,_string_openquote,_s |
---|
| _quote(string_query,_string_openquote,_s |
---|
|
quote(String query, String openQuote, String closeQuote)The quote function convert any '`'s to the provided open and closing quotes.
Template |
{{ quote("SELECT * FROM `TUTORIAL`.`CUSTOMER`;", "[", "]") }}
|
Output |
...
|
SELECT * FROM [TUTORIAL].[CUSTOMER];
|
...
Anchor |
---|
| _uniquetablename(table_table,_string_tab |
---|
| _uniquetablename(table_table,_string_tab |
---|
|
uniqueTableName(Table table, String tableName, String schemaName)The uniqueTableName function will return a String for a unique table name based on the provided names.
Example |
{#- table is named TUTORIAL.CUSTOMER. And TUTORIAL.PRODUCT exists -#}
{{- uniqueTableName(table, "CUSTOMER", "TUTORIAL") -}}{%- br -%}
{{- uniqueTableName(table, "PRODUCT", "TUTORIAL") -}}
|
Output |
CUSTOMER
PRODUCT_1
|