Files
semprini-data-product-templ…/canonical_data_product/lakehouse/010_replication.sql
T
paulandClaude Opus 5 62a3714562 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>
2026-09-17 22:55:11 +12:00

23 lines
1.1 KiB
SQL

-- {{product.name}}: 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.{{product.schema}}.<table>.
CREATE SCHEMA IF NOT EXISTS {{product.schema}};
-- >>> repeat per entity table, parents before children
SELECT duckpipe.add_table(
'{{product.schema}}.{{table}}',
target_table => '{{product.schema}}.{{table}}',
sync_group => 'ods'
);
-- <<< end repeat
-- 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; see docs/security-architecture.md.
GRANT USAGE ON SCHEMA {{product.schema}} TO ducklake_reader, ducklake_writer;
GRANT SELECT ON ALL TABLES IN SCHEMA {{product.schema}} TO ducklake_reader, ducklake_writer;