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>
32 lines
1.4 KiB
PL/PgSQL
32 lines
1.4 KiB
PL/PgSQL
-- Canonical Party: API surface (runs on the ods service).
|
|
--
|
|
-- PostgREST connects as `authenticator` and switches to the platform's `anon` role, so the
|
|
-- GraphQL API sees exactly what `anon` is granted here. The lab has no authentication; a real
|
|
-- deployment would grant per-consumer roles and add row-level security policies.
|
|
|
|
GRANT USAGE ON SCHEMA canonical_party TO anon;
|
|
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA canonical_party TO anon;
|
|
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA canonical_party TO anon;
|
|
ALTER DEFAULT PRIVILEGES IN SCHEMA canonical_party GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO anon;
|
|
|
|
-- The product's GraphQL endpoint: POST /rpc/canonical_party_graphql through PostgREST.
|
|
-- pg_graphql reflects the schemas on the search_path, so the SET clause is what scopes this
|
|
-- endpoint to the product's tables and keeps other products out of its schema.
|
|
CREATE FUNCTION api.canonical_party_graphql(
|
|
query text,
|
|
variables jsonb DEFAULT '{}'::jsonb,
|
|
"operationName" text DEFAULT NULL,
|
|
extensions jsonb DEFAULT NULL
|
|
) RETURNS jsonb
|
|
LANGUAGE sql
|
|
SECURITY INVOKER
|
|
SET search_path = canonical_party, graphql
|
|
AS $$
|
|
SELECT graphql.resolve(query, variables, "operationName", extensions);
|
|
$$;
|
|
|
|
GRANT EXECUTE ON FUNCTION api.canonical_party_graphql(text, jsonb, text, jsonb) TO anon;
|
|
|
|
-- PostgREST caches the API definition; ask it to pick up the new endpoint.
|
|
NOTIFY pgrst, 'reload schema';
|