Files
semprini-domain-cdp-digital…/canonical-party/lakehouse/010_replication.sql
T
paulandClaude Opus 5 cfb32d2d1b Add Canonical Party as generated in semprini-blog-dataproducts
The canonical data product for the Digital Core domain, copied unchanged from
the blog repository's products/canonical-party (generated by /agent-product
from data_model/data_products/canonical.md, 65 of 65 checks on the blog's
stack on 2026-09-09). The next commit adapts it to the domain platform.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 23:21:27 +12:00

63 lines
1.8 KiB
SQL

-- Canonical Party: analytical replication into DuckLake (runs on the lakehouse service).
--
-- pg_duckpipe follows the ODS write-ahead log and maintains a DuckLake copy of each table as
-- Parquet in the digital-lake bucket. The platform-level sync group `digital_oltp` already
-- points at the ODS (see compose.yml); the product only registers its tables with it.
-- Trino reads the result as lake.canonical_party.<table>.
CREATE SCHEMA IF NOT EXISTS canonical_party;
SELECT duckpipe.add_table(
'canonical_party.party',
target_table => 'canonical_party.party',
sync_group => 'digital_oltp'
);
SELECT duckpipe.add_table(
'canonical_party.address',
target_table => 'canonical_party.address',
sync_group => 'digital_oltp'
);
SELECT duckpipe.add_table(
'canonical_party.person',
target_table => 'canonical_party.person',
sync_group => 'digital_oltp'
);
SELECT duckpipe.add_table(
'canonical_party.company',
target_table => 'canonical_party.company',
sync_group => 'digital_oltp'
);
SELECT duckpipe.add_table(
'canonical_party.party_role',
target_table => 'canonical_party.party_role',
sync_group => 'digital_oltp'
);
SELECT duckpipe.add_table(
'canonical_party.customer',
target_table => 'canonical_party.customer',
sync_group => 'digital_oltp'
);
SELECT duckpipe.add_table(
'canonical_party.contact_address',
target_table => 'canonical_party.contact_address',
sync_group => 'digital_oltp'
);
SELECT duckpipe.add_table(
'canonical_party.party_role_contact_address',
target_table => 'canonical_party.party_role_contact_address',
sync_group => 'digital_oltp'
);
SELECT duckpipe.add_table(
'canonical_party.party_association',
target_table => 'canonical_party.party_association',
sync_group => 'digital_oltp'
);