Add the canonical data product template
Moves the data product template from semprini-blog-dataproducts, as adapted to the semprini-data domain platform, into canonical_data_product/. Its worked example passed 9 of 9 checks on the domain platform on 2026-09-17. Adds agent-canonical-product, the blog's agent-product adapted to generate a product into a domain repository from a declaration in the domain's model repository, and README/CLAUDE.md describing the template catalogue, the product contract with the domain platform, and team ownership. Source-aligned and experience templates are planned. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
commit
62a3714562
30 files changed
+1529
No files matched your search
@@ -0,0 +1,89 @@
|
||||
-- {{product.name}}: streaming job (Flink SQL, Flink 2.2).
|
||||
-- Submitted by `data-domain deploy` with `bin/sql-client.sh -f job.sql` on the jobmanager.
|
||||
-- ${ODS_PASSWORD} is substituted from the domain's .env at submission and never committed.
|
||||
--
|
||||
-- Per entity table, four Flink tables and two continuous INSERTs:
|
||||
-- <table>_inbound kafka Publish Input: records producers publish (JSON, schema in events/schemas)
|
||||
-- <table>_ods jdbc upserts inbound records into the ODS table by primary key
|
||||
-- <table>_cdc postgres-cdc every change committed to the ODS table, however it arrived
|
||||
-- <table>_outbound upsert-kafka Subscribe Output: compacted topic keyed by <table>_id, deletes as tombstones
|
||||
-- Column lists match the ODS table (snake_case). Types follow the mapping table in README.md.
|
||||
-- Requires the connector jars listed under "Platform prerequisites" in README.md.
|
||||
|
||||
SET 'pipeline.name' = '{{product.slug}}';
|
||||
SET 'execution.checkpointing.interval' = '10 s';
|
||||
|
||||
-- >>> repeat per entity table
|
||||
CREATE TABLE {{table}}_inbound (
|
||||
{{table}}_id STRING,
|
||||
{{column}} {{flink_type}},
|
||||
{{parent_table}}_id STRING
|
||||
) WITH (
|
||||
'connector' = 'kafka',
|
||||
'topic' = '{{domain.slug}}.{{product.slug}}.{{table}}.inbound',
|
||||
'properties.bootstrap.servers' = 'kafka:29092',
|
||||
'properties.group.id' = '{{product.slug}}.{{table}}.inbound',
|
||||
'scan.startup.mode' = 'group-offsets',
|
||||
'properties.auto.offset.reset' = 'earliest',
|
||||
'format' = 'json',
|
||||
'json.fail-on-missing-field' = 'false',
|
||||
'json.ignore-parse-errors' = 'false',
|
||||
'json.timestamp-format.standard' = 'ISO-8601'
|
||||
);
|
||||
|
||||
CREATE TABLE {{table}}_ods (
|
||||
{{table}}_id STRING,
|
||||
{{column}} {{flink_type}},
|
||||
{{parent_table}}_id STRING,
|
||||
PRIMARY KEY ({{table}}_id) NOT ENFORCED
|
||||
) WITH (
|
||||
'connector' = 'jdbc',
|
||||
'url' = 'jdbc:postgresql://ods:5432/ods?stringtype=unspecified',
|
||||
'table-name' = '{{product.schema}}.{{table}}',
|
||||
'username' = 'postgres',
|
||||
'password' = '${ODS_PASSWORD}'
|
||||
);
|
||||
|
||||
CREATE TABLE {{table}}_cdc (
|
||||
{{table}}_id STRING,
|
||||
{{column}} {{flink_type}},
|
||||
{{parent_table}}_id STRING,
|
||||
updated_at TIMESTAMP_LTZ(6),
|
||||
PRIMARY KEY ({{table}}_id) NOT ENFORCED
|
||||
) WITH (
|
||||
'connector' = 'postgres-cdc',
|
||||
'hostname' = 'ods',
|
||||
'port' = '5432',
|
||||
'username' = 'postgres',
|
||||
'password' = '${ODS_PASSWORD}',
|
||||
'database-name' = 'ods',
|
||||
'schema-name' = '{{product.schema}}',
|
||||
'table-name' = '{{table}}',
|
||||
'slot.name' = '{{product.schema}}_{{table}}_flink',
|
||||
'decoding.plugin.name' = 'pgoutput',
|
||||
'scan.incremental.snapshot.enabled' = 'true'
|
||||
);
|
||||
|
||||
CREATE TABLE {{table}}_outbound (
|
||||
{{table}}_id STRING,
|
||||
{{column}} {{flink_type}},
|
||||
{{parent_table}}_id STRING,
|
||||
updated_at TIMESTAMP_LTZ(6),
|
||||
PRIMARY KEY ({{table}}_id) NOT ENFORCED
|
||||
) WITH (
|
||||
'connector' = 'upsert-kafka',
|
||||
'topic' = '{{domain.slug}}.{{product.slug}}.{{table}}.outbound',
|
||||
'properties.bootstrap.servers' = 'kafka:29092',
|
||||
'key.format' = 'raw',
|
||||
'value.format' = 'json',
|
||||
'value.json.timestamp-format.standard' = 'ISO-8601'
|
||||
);
|
||||
-- <<< end repeat
|
||||
|
||||
EXECUTE STATEMENT SET
|
||||
BEGIN
|
||||
-- >>> repeat per entity table
|
||||
INSERT INTO {{table}}_ods SELECT * FROM {{table}}_inbound;
|
||||
INSERT INTO {{table}}_outbound SELECT * FROM {{table}}_cdc;
|
||||
-- <<< end repeat
|
||||
END;
|
||||
Reference in new issue
Block a user