ores.sql.populate

Table of Contents

This page is the node for the ores.sql.populate facet of the codegen template library, part of the ores.sql technical space. Each archetype below is documented, and holds its mustache source, in its own linked page — this page is the facet-level summary and the routing table to them.

1. Summary

Reference-data INSERT templates: dataset and catalog registration, ISO and non-ISO currencies, countries, flag and icon image artefacts, IP to country ranges, methodologies, tags, and the batch-execute master include. None belongs to a profile — all are invoked directly by the codegen dataset pipeline.

2. The ores.sql.populate facet

The data projection: where ores.sql.schema renders an entity's shape, these templates render its contents — typed datasets (ISO 4217, ISO 3166, FPML coding schemes, …) traced back to their source via dataset rows, dependency links, catalogs and methodologies. The recurring pattern is one INSERT block per item inside a dataset section, each row carrying the dataset code for provenance.

An archetype's #+data_source: names the payload files it reads, and it may name more than one. A dataset's own directory holds its model and its payloads together, so an artefact archetype reads its own images.json alongside the manifest.json that says which dataset it belongs to and where that dataset's source documents are.

3. Mustache incantations

Several templates predate the standard header and open with their own {{! purpose }} comment plus an AUTO-GENERATED SQL banner — both preserved verbatim. FPML templates branch on optional fields with {{#field}}/{{^field}} pairs (e.g. publication_date, description); the image-artefact template inlines whole SVG documents via {{{svg}}}. Otherwise the group's standard constructs.

4. Archetypes

Archetype Description
ores.sql.populate.batch_execute Master include for a dataset: \ir every generated file in dependency order ({{#model.files}}), with \echo progress markers. The original file had no trailing newline; tangling added one (render-neutral, verified).
ores.sql.populate.catalog Registers data catalogs ({{#catalogs}}: name, owner, description).
ores.sql.populate.country ISO 3166 countries from the country_currency dataset rows: code, numeric, name, official name, traced to {{countries_dataset.name}}.
ores.sql.populate.currency ISO 4217 currencies joined to their countries ({{#country_currency}}), with monetary_nature and lower-cased country code for flag linkage.
ores.sql.populate.dataset Registers the datasets themselves ({{#datasets}}: code, name, catalog, coding scheme, asset type, business context) — the provenance rows every other populate references.
ores.sql.populate.dataset_dependency Parent/child links between datasets ({{#dataset_dependencies}}: parent code, dependency code, role) so consumers can order loads.
ores.sql.populate.image_artefact Image artefacts as ores_dq_images_artefact_tbl rows: {{#image_artefact.items}} inlines one SVG document per {{key}}, read from the directory the manifest's source declares.
ores.sql.populate.ip2country IPv4-to-country ranges as ores_dq_ip2country_artefact_tbl rows, loaded from the dataset's source TSV by the generated script's own psql \copy.
ores.sql.populate.methodology Dataset methodologies ({{#methodologies}}: name, description, steps, url) documenting how each dataset was produced.
ores.sql.populate.tag Classification tags (domain, subject area, name, description) per dataset.

5. See also

Emacs 29.3 (Org mode 9.6.15)