Files
semprini-domain-cdp-digital…/canonical-party/lakehouse/010_replication.sql
T
paulandClaude Opus 5 dd096ee4dc Adapt Canonical Party to the domain platform; add unit tests
Makes the blog-generated product run on the digital-core domain built from
semprini-data-domain, with the same changes the canonical template received:
- flink/job.sql connects to ods:5432/ods as postgres with ${ODS_PASSWORD},
  substituted by data-domain at submission, instead of the blog's credentials
- lakehouse/010_replication.sql uses the platform's `ods` sync group and grants
  the lake tables to ducklake_reader and ducklake_writer
- product.yaml sync group, odps.yaml access URLs (domain ports 20000-20003,
  management zone Apicurio on 8081), CLI names in comments

Adds tests/: the canonical template's generic unit tests and this product's
expectations.yaml (seed rows, 24 constraint rejections, 5 relationship
traversals, one inbound-to-tombstone round trip).

Verified on digital-core on 2026-09-18: 65 of 65 smoke checks, 100 unit tests
passing, and registered in OpenMetadata under the digital-core domain.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 00:14:36 +12:00

69 lines
2.1 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 domain's `lake` bucket. The platform-level sync group `ods` already points
-- at the ODS (platform/compose.domain.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 => 'ods'
);
SELECT duckpipe.add_table(
'canonical_party.address',
target_table => 'canonical_party.address',
sync_group => 'ods'
);
SELECT duckpipe.add_table(
'canonical_party.person',
target_table => 'canonical_party.person',
sync_group => 'ods'
);
SELECT duckpipe.add_table(
'canonical_party.company',
target_table => 'canonical_party.company',
sync_group => 'ods'
);
SELECT duckpipe.add_table(
'canonical_party.party_role',
target_table => 'canonical_party.party_role',
sync_group => 'ods'
);
SELECT duckpipe.add_table(
'canonical_party.customer',
target_table => 'canonical_party.customer',
sync_group => 'ods'
);
SELECT duckpipe.add_table(
'canonical_party.contact_address',
target_table => 'canonical_party.contact_address',
sync_group => 'ods'
);
SELECT duckpipe.add_table(
'canonical_party.party_role_contact_address',
target_table => 'canonical_party.party_role_contact_address',
sync_group => 'ods'
);
SELECT duckpipe.add_table(
'canonical_party.party_association',
target_table => 'canonical_party.party_association',
sync_group => 'ods'
);
-- Readers (Trino) and writers (dbt, building experience products on top) need the tables.
-- pg_ducklake does not yet enforce SELECT on DuckLake tables, so these grants document intent
-- as much as they control it.
GRANT USAGE ON SCHEMA canonical_party TO ducklake_reader, ducklake_writer;
GRANT SELECT ON ALL TABLES IN SCHEMA canonical_party TO ducklake_reader, ducklake_writer;