Archetype: sql_dataset_populate.mustache

Table of Contents

Registers the datasets themselves ({{#datasets}}: code, name, catalog, coding scheme, asset type, business context) — the provenance rows every other populate references.

See the Template variable reference for the complete list of available variables and their semantics.

Template

The full template source. Edit here and re-tangle with compass build --direct tangle_codegen_templates to regenerate library/templates/sql_dataset_populate.mustache.

{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/sql_populate.org. Edit the org source. }}
{{! Template to generate SQL with enhanced GPL v3 license and dataset data }}
{{{sql_license}}}
/*
 * AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
 * Template: sql_dataset_populate.mustache
 * To modify, update the template and regenerate.
 */

-- =============================================================================
-- Data Quality Slovaris Datasets
-- =============================================================================

\echo '--- Data Quality Slovaris Datasets ---'

{{#datasets}}
select ores_dq_datasets_upsert_fn(ores_utility_system_tenant_id_fn(),
    '{{code}}',
    '{{catalog_name}}',
    '{{subject_area_name}}',
    '{{domain_name}}',
    '{{coding_scheme_code}}',
    '{{origin_code}}',
    '{{nature_code}}',
    '{{treatment_code}}',
    '{{methodology_name}}',
    '{{name}}',
    '{{description}}',
    '{{source_system_id}}',
    '{{business_context}}',
    current_date,
    '{{license_info}}',
    '{{asset_type}}'
);
{{/datasets}}

-- =============================================================================
-- Summary
-- =============================================================================

\echo ''
\echo '--- Summary ---'

select 'Data Quality Total Datasets' as entity, count(*) as count
from ores_dq_datasets_tbl where valid_to = ores_utility_infinity_timestamp_fn()
order by entity;

See also

Emacs 29.1 (Org mode 9.6.6)