-- Example Address: streaming job (Flink SQL, Flink 2.2). -- Submitted by `data-domain deploy` with `bin/sql-client.sh -f job.sql` on the jobmanager. -- ${ODS_PASSWORD} is substituted from the domain's .env at submission and never committed. -- address_inbound reads records keyed by address_id: only messages sharing a key share a -- partition, and only one partition keeps them in order. SET 'pipeline.name' = 'example-address'; SET 'execution.checkpointing.interval' = '10 s'; CREATE TABLE address_inbound ( address_id STRING, address_type STRING, address_line_1 STRING, address_line_2 STRING, suburb STRING, city STRING, state_or_region STRING, postcode STRING, country STRING ) WITH ( 'connector' = 'kafka', 'topic' = 'digital-core.example-address.address.inbound', 'properties.bootstrap.servers' = 'kafka:29092', 'properties.group.id' = 'example-address.address.inbound', 'scan.startup.mode' = 'group-offsets', 'properties.auto.offset.reset' = 'earliest', 'format' = 'json', 'json.fail-on-missing-field' = 'false', 'json.ignore-parse-errors' = 'false', 'json.timestamp-format.standard' = 'ISO-8601' ); CREATE TABLE address_ods ( address_id STRING, address_type STRING, address_line_1 STRING, address_line_2 STRING, suburb STRING, city STRING, state_or_region STRING, postcode STRING, country STRING, PRIMARY KEY (address_id) NOT ENFORCED ) WITH ( 'connector' = 'jdbc', 'url' = 'jdbc:postgresql://ods:5432/ods?stringtype=unspecified', 'table-name' = 'example_address.address', 'username' = 'postgres', 'password' = '${ODS_PASSWORD}' ); CREATE TABLE address_cdc ( address_id STRING, address_type STRING, address_line_1 STRING, address_line_2 STRING, suburb STRING, city STRING, state_or_region STRING, postcode STRING, country STRING, updated_at TIMESTAMP_LTZ(6), PRIMARY KEY (address_id) NOT ENFORCED ) WITH ( 'connector' = 'postgres-cdc', 'hostname' = 'ods', 'port' = '5432', 'username' = 'postgres', 'password' = '${ODS_PASSWORD}', 'database-name' = 'ods', 'schema-name' = 'example_address', 'table-name' = 'address', 'slot.name' = 'example_address_address_flink', 'decoding.plugin.name' = 'pgoutput', 'scan.incremental.snapshot.enabled' = 'true' ); CREATE TABLE address_outbound ( address_id STRING, address_type STRING, address_line_1 STRING, address_line_2 STRING, suburb STRING, city STRING, state_or_region STRING, postcode STRING, country STRING, updated_at TIMESTAMP_LTZ(6), PRIMARY KEY (address_id) NOT ENFORCED ) WITH ( 'connector' = 'upsert-kafka', 'topic' = 'digital-core.example-address.address.outbound', 'properties.bootstrap.servers' = 'kafka:29092', 'key.format' = 'raw', 'value.format' = 'json', 'value.json.timestamp-format.standard' = 'ISO-8601' ); EXECUTE STATEMENT SET BEGIN INSERT INTO address_ods SELECT * FROM address_inbound; INSERT INTO address_outbound SELECT * FROM address_cdc; END;