Files
semprini-domain-cdp-digital…/canonical-party/ods/040_seed.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
5.2 KiB
SQL

-- Canonical Party: sample rows (runs on the ods service).
--
-- Fixed uuids so child rows can reference their parents and so the same rows can be published
-- to the inbound topics or queried through GraphQL in examples. The second uuid group numbers
-- the table (0001 party, 0002 address, 0003 party_role, 0004 contact_address, 0005
-- party_role_contact_address, 0006 party_association); subtype rows reuse their parent's id.
INSERT INTO canonical_party.party
(party_id, party_type, legal_name, also_known_as, party_status)
VALUES
('7d1e5a2c-0001-4a7b-9c11-000000000001', 'Person', 'Alice Margaret Ng', 'Alice Ng', 'Active'),
('7d1e5a2c-0001-4a7b-9c11-000000000002', 'Person', 'Rangi Parata', NULL, 'Active'),
('7d1e5a2c-0001-4a7b-9c11-000000000003', 'Company', 'Kowhai Trading Limited', 'Kowhai Trading; KTL', 'Active'),
('7d1e5a2c-0001-4a7b-9c11-000000000004', 'Company', 'Harbour Logistics Pty Ltd', 'Harbour Logistics', 'Prospect');
INSERT INTO canonical_party.address
(address_id, address_type, address_line_1, address_line_2, suburb, city, state_or_region, postcode, country)
VALUES
('7d1e5a2c-0002-4a7b-9c11-000000000001', 'Street Address', '1 Queen Street', NULL, 'Auckland Central', 'Auckland', 'Auckland', '1010', 'NZ'),
('7d1e5a2c-0002-4a7b-9c11-000000000002', 'PO Box', 'PO Box 123', NULL, NULL, 'Wellington', 'Wellington', '6140', 'NZ'),
('7d1e5a2c-0002-4a7b-9c11-000000000003', 'Registered Office', 'Level 5, 100 Collins Street', NULL, NULL, 'Melbourne', 'VIC', '3000', 'AU');
INSERT INTO canonical_party.person
(person_id, date_of_birth, preferred_name, country_of_residence)
VALUES
('7d1e5a2c-0001-4a7b-9c11-000000000001', '1985-03-14', 'Alice', 'NZ'),
('7d1e5a2c-0001-4a7b-9c11-000000000002', '1990-11-02', 'Rangi', 'NZ');
INSERT INTO canonical_party.company
(company_id, company_registration_number, incorporation_country, incorporation_date, legal_structure, tax_identifier)
VALUES
('7d1e5a2c-0001-4a7b-9c11-000000000003', '9429041234567', 'NZ', '2012-07-01', 'Private Company', '123-456-789'),
('7d1e5a2c-0001-4a7b-9c11-000000000004', '123456789', 'AU', '2005-03-15', 'Private Company', '51 824 753 556');
INSERT INTO canonical_party.party_role
(party_role_id, party_role_type, role_status, role_start_date, role_end_date, party_id)
VALUES
('7d1e5a2c-0003-4a7b-9c11-000000000001', 'Customer', 'Active', '2020-01-15', NULL, '7d1e5a2c-0001-4a7b-9c11-000000000001'),
('7d1e5a2c-0003-4a7b-9c11-000000000002', 'Customer', 'Active', '2018-06-01', NULL, '7d1e5a2c-0001-4a7b-9c11-000000000003'),
('7d1e5a2c-0003-4a7b-9c11-000000000003', 'Customer', 'Closed', '2021-03-01', '2024-08-31', '7d1e5a2c-0001-4a7b-9c11-000000000002');
INSERT INTO canonical_party.customer
(customer_id, customer_number, onboarding_date, relationship_start_date)
VALUES
('7d1e5a2c-0003-4a7b-9c11-000000000001', 'CUST-000001', '2020-01-15', '2020-01-15'),
('7d1e5a2c-0003-4a7b-9c11-000000000002', 'CUST-000002', '2018-06-01', '2015-06-01'),
('7d1e5a2c-0003-4a7b-9c11-000000000003', 'CUST-000003', '2021-03-01', '2021-03-01');
INSERT INTO canonical_party.contact_address
(contact_address_id, address_purpose, is_primary, verification_status, verification_date, verification_method, valid_from, valid_to, party_id, address_id)
VALUES
('7d1e5a2c-0004-4a7b-9c11-000000000001', 'Home', true, 'Verified', '2024-02-10', 'Documentary', '2019-12-01', NULL, '7d1e5a2c-0001-4a7b-9c11-000000000001', '7d1e5a2c-0002-4a7b-9c11-000000000001'),
('7d1e5a2c-0004-4a7b-9c11-000000000002', 'Mailing', true, 'Unverified', NULL, NULL, '2022-01-01', NULL, '7d1e5a2c-0001-4a7b-9c11-000000000001', '7d1e5a2c-0002-4a7b-9c11-000000000002'),
('7d1e5a2c-0004-4a7b-9c11-000000000003', 'Registered Office', true, 'Verified', '2023-05-20', 'Electronic', '2012-07-01', NULL, '7d1e5a2c-0001-4a7b-9c11-000000000003', '7d1e5a2c-0002-4a7b-9c11-000000000003');
INSERT INTO canonical_party.party_role_contact_address
(party_role_contact_address_id, party_role_id, contact_address_id)
VALUES
('7d1e5a2c-0005-4a7b-9c11-000000000001', '7d1e5a2c-0003-4a7b-9c11-000000000001', '7d1e5a2c-0004-4a7b-9c11-000000000001'),
('7d1e5a2c-0005-4a7b-9c11-000000000002', '7d1e5a2c-0003-4a7b-9c11-000000000001', '7d1e5a2c-0004-4a7b-9c11-000000000002'),
('7d1e5a2c-0005-4a7b-9c11-000000000003', '7d1e5a2c-0003-4a7b-9c11-000000000002', '7d1e5a2c-0004-4a7b-9c11-000000000003');
INSERT INTO canonical_party.party_association
(party_association_id, source_party_id, target_party_id, association_type, association_start_date, association_end_date, verified)
VALUES
('7d1e5a2c-0006-4a7b-9c11-000000000001', '7d1e5a2c-0001-4a7b-9c11-000000000001', '7d1e5a2c-0001-4a7b-9c11-000000000003', 'Director', '2015-01-01', NULL, true),
('7d1e5a2c-0006-4a7b-9c11-000000000002', '7d1e5a2c-0001-4a7b-9c11-000000000001', '7d1e5a2c-0001-4a7b-9c11-000000000003', 'Authorised Signatory', '2015-01-01', NULL, true),
('7d1e5a2c-0006-4a7b-9c11-000000000003', '7d1e5a2c-0001-4a7b-9c11-000000000002', '7d1e5a2c-0001-4a7b-9c11-000000000001', 'Partner', '2016-06-01', NULL, false);