Completes the AP source layer: GP was covered by the pm* modules, but the CMS side had only cms.vend. These three are what SQL/fiscal/analysis/open_ap_aging.db2.sql actually joins. avtx 966,553 A/P voucher transaction events incremental on AVTSTM vchr 792,348 vouchers entered, period to date full open 538,544 open payables; FHCBAL is live full AVTX is the artrn analog -- the per-event apply detail. It matters because the AR aging in /opt/clean reconstructs balances from application events rather than a single settle_date, so AP needs an applications fact too, not just documents. Grains verified exactly unique before drafting: AVTX (avtco#,avtvh#,avttx#) 966,553/966,553; VCHR (idcom#,idvch#,idbnk#,idfisy,idfisp) 792,348/792,348; OPEN (fhcom#,fhvch#,fhpyy,fhpper) 538,544/538,544. All three reconcile IN SYNC. vchr and open stay full: no change signal, only business dates, and FHCBAL is a live mutable balance. Two things worth knowing for the next DB2 module: - pipekit maps DB2 TIMESTMP to Postgres text, so a watermark resolver doing COALESCE(MAX(ts), TIMESTAMP '...') fails on mismatched types. Cast explicitly. cms.gtran was already the precedent. - Watermarks resolve at engine step 2 but --create-dest builds the table at step 3b, so a watermark reading its own dest table fails on the first run. Pre-create the table or seed with a constant. Note LGDAT.AP* is a dead end -- APVH has 14 rows, APVD has 22. CMS AP does not live in AP-prefixed files. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
269 lines
6.9 KiB
JSON
269 lines
6.9 KiB
JSON
{
|
|
"name": "avtx",
|
|
"source_connection": "S78030956",
|
|
"dest_connection": "usmidsap02",
|
|
"dest_table": "cms.avtx",
|
|
"staging_table": "pipekit_staging.avtx",
|
|
"merge_strategy": "incremental",
|
|
"merge_key": "avtco#, avtvh#, avttx#",
|
|
"enabled": 1,
|
|
"dest_description": "CMS A/P voucher transaction events (payments, discounts, adjustments)",
|
|
"description": "CMS A/P voucher transaction events (payments, discounts, adjustments)",
|
|
"columns": [
|
|
{
|
|
"source_name": "AVTCO#",
|
|
"source_type": "NUMERIC(2,0)",
|
|
"dest_name": "avtco#",
|
|
"dest_type": "numeric(2,0)",
|
|
"description": "Company Number"
|
|
},
|
|
{
|
|
"source_name": "AVTVH#",
|
|
"source_type": "NUMERIC(6,0)",
|
|
"dest_name": "avtvh#",
|
|
"dest_type": "numeric(6,0)",
|
|
"description": "Voucher'Number"
|
|
},
|
|
{
|
|
"source_name": "AVTTX#",
|
|
"source_type": "NUMERIC(9,0)",
|
|
"dest_name": "avttx#",
|
|
"dest_type": "numeric(9,0)",
|
|
"description": "Transaction'Number"
|
|
},
|
|
{
|
|
"source_name": "AVTTDT",
|
|
"source_type": "DATE",
|
|
"dest_name": "avttdt",
|
|
"dest_type": "date",
|
|
"description": "Transaction Date"
|
|
},
|
|
{
|
|
"source_name": "AVTTYP",
|
|
"source_type": "CHAR(2)",
|
|
"dest_name": "avttyp",
|
|
"dest_type": "text",
|
|
"description": "Transaction Type"
|
|
},
|
|
{
|
|
"source_name": "AVT1099",
|
|
"source_type": "CHAR(1)",
|
|
"dest_name": "avt1099",
|
|
"dest_type": "text",
|
|
"description": "1099 Applicable"
|
|
},
|
|
{
|
|
"source_name": "AVTSTM",
|
|
"source_type": "TIMESTMP",
|
|
"dest_name": "avtstm",
|
|
"dest_type": "text",
|
|
"description": "Actual Time Stamp"
|
|
},
|
|
{
|
|
"source_name": "AVTFIS",
|
|
"source_type": "NUMERIC(6,0)",
|
|
"dest_name": "avtfis",
|
|
"dest_type": "numeric(6,0)",
|
|
"description": "Fiscal Period"
|
|
},
|
|
{
|
|
"source_name": "AVTAMT",
|
|
"source_type": "NUMERIC(11,2)",
|
|
"dest_name": "avtamt",
|
|
"dest_type": "numeric(11,2)",
|
|
"description": "Cheque Paid Amount"
|
|
},
|
|
{
|
|
"source_name": "AVTCCD",
|
|
"source_type": "CHAR(3)",
|
|
"dest_name": "avtccd",
|
|
"dest_type": "text",
|
|
"description": "Currency Code"
|
|
},
|
|
{
|
|
"source_name": "AVTVAM",
|
|
"source_type": "NUMERIC(11,2)",
|
|
"dest_name": "avtvam",
|
|
"dest_type": "numeric(11,2)",
|
|
"description": "Amount in Voucher Curr"
|
|
},
|
|
{
|
|
"source_name": "AVTVCC",
|
|
"source_type": "CHAR(3)",
|
|
"dest_name": "avtvcc",
|
|
"dest_type": "text",
|
|
"description": "Voucher Currency"
|
|
},
|
|
{
|
|
"source_name": "AVTDIS",
|
|
"source_type": "NUMERIC(11,2)",
|
|
"dest_name": "avtdis",
|
|
"dest_type": "numeric(11,2)",
|
|
"description": "Discount Taken"
|
|
},
|
|
{
|
|
"source_name": "AVTEXC",
|
|
"source_type": "NUMERIC(11,6)",
|
|
"dest_name": "avtexc",
|
|
"dest_type": "numeric(11,6)",
|
|
"description": "Exchange Rate Voucher Currency"
|
|
},
|
|
{
|
|
"source_name": "AVTCHC",
|
|
"source_type": "NUMERIC(2,0)",
|
|
"dest_name": "avtchc",
|
|
"dest_type": "numeric(2,0)",
|
|
"description": "Cheque Company"
|
|
},
|
|
{
|
|
"source_name": "AVTCHB",
|
|
"source_type": "CHAR(3)",
|
|
"dest_name": "avtchb",
|
|
"dest_type": "text",
|
|
"description": "Cheque Bank Code"
|
|
},
|
|
{
|
|
"source_name": "AVTCHQ",
|
|
"source_type": "NUMERIC(8,0)",
|
|
"dest_name": "avtchq",
|
|
"dest_type": "numeric(8,0)",
|
|
"description": "Cheque Number"
|
|
},
|
|
{
|
|
"source_name": "AVTEFT",
|
|
"source_type": "CHAR(20)",
|
|
"dest_name": "avteft",
|
|
"dest_type": "text",
|
|
"description": "EFT #"
|
|
},
|
|
{
|
|
"source_name": "AVTOBL",
|
|
"source_type": "NUMERIC(11,2)",
|
|
"dest_name": "avtobl",
|
|
"dest_type": "numeric(11,2)",
|
|
"description": "New Balance"
|
|
},
|
|
{
|
|
"source_name": "AVTUSR",
|
|
"source_type": "CHAR(10)",
|
|
"dest_name": "avtusr",
|
|
"dest_type": "text",
|
|
"description": "User ID"
|
|
},
|
|
{
|
|
"source_name": "AVTEXCP",
|
|
"source_type": "NUMERIC(11,6)",
|
|
"dest_name": "avtexcp",
|
|
"dest_type": "numeric(11,6)",
|
|
"description": "Exchange Rate Cheque Currency"
|
|
},
|
|
{
|
|
"source_name": "AVTHQEXCP",
|
|
"source_type": "NUMERIC(11,6)",
|
|
"dest_name": "avthqexcp",
|
|
"dest_type": "numeric(11,6)",
|
|
"description": "HQ Exchange Rate Cheque Currency"
|
|
},
|
|
{
|
|
"source_name": "AVTEXCM",
|
|
"source_type": "NUMERIC(11,6)",
|
|
"dest_name": "avtexcm",
|
|
"dest_type": "numeric(11,6)",
|
|
"description": "Man. Cheq. Exc. Rate Entered"
|
|
},
|
|
{
|
|
"source_name": "AVTOEX",
|
|
"source_type": "NUMERIC(11,6)",
|
|
"dest_name": "avtoex",
|
|
"dest_type": "numeric(11,6)",
|
|
"description": "Overridden Exchange Rate"
|
|
},
|
|
{
|
|
"source_name": "AVTIRDT",
|
|
"source_type": "DATE",
|
|
"dest_name": "avtirdt",
|
|
"dest_type": "date",
|
|
"description": "Invoice Received Date"
|
|
},
|
|
{
|
|
"source_name": "AVTDSNT",
|
|
"source_type": "NUMERIC(9,2)",
|
|
"dest_name": "avtdsnt",
|
|
"dest_type": "numeric(9,2)",
|
|
"description": "Net Discount Amount"
|
|
},
|
|
{
|
|
"source_name": "AVTGSTD",
|
|
"source_type": "NUMERIC(9,2)",
|
|
"dest_name": "avtgstd",
|
|
"dest_type": "numeric(9,2)",
|
|
"description": "Recoverable Discount Amount"
|
|
},
|
|
{
|
|
"source_name": "AVTFUT1",
|
|
"source_type": "CHAR(1)",
|
|
"dest_name": "avtfut1",
|
|
"dest_type": "text",
|
|
"description": "Future Use"
|
|
},
|
|
{
|
|
"source_name": "AVTFUT2",
|
|
"source_type": "CHAR(1)",
|
|
"dest_name": "avtfut2",
|
|
"dest_type": "text",
|
|
"description": "Future Use"
|
|
},
|
|
{
|
|
"source_name": "AVTFUT3",
|
|
"source_type": "NUMERIC(15,5)",
|
|
"dest_name": "avtfut3",
|
|
"dest_type": "numeric(15,5)",
|
|
"description": "Future Use"
|
|
},
|
|
{
|
|
"source_name": "AVTFUT4",
|
|
"source_type": "NUMERIC(15,5)",
|
|
"dest_name": "avtfut4",
|
|
"dest_type": "numeric(15,5)",
|
|
"description": "Future Use"
|
|
},
|
|
{
|
|
"source_name": "AVTFUT5",
|
|
"source_type": "CHAR(10)",
|
|
"dest_name": "avtfut5",
|
|
"dest_type": "text",
|
|
"description": "User-Defined Date"
|
|
},
|
|
{
|
|
"source_name": "AVTFUT6",
|
|
"source_type": "CHAR(10)",
|
|
"dest_name": "avtfut6",
|
|
"dest_type": "text",
|
|
"description": "Future Use"
|
|
},
|
|
{
|
|
"source_name": "AVTFUT7",
|
|
"source_type": "CHAR(20)",
|
|
"dest_name": "avtfut7",
|
|
"dest_type": "text",
|
|
"description": "Future Use"
|
|
},
|
|
{
|
|
"source_name": "AVTFUT8",
|
|
"source_type": "CHAR(20)",
|
|
"dest_name": "avtfut8",
|
|
"dest_type": "text",
|
|
"description": "Future Use"
|
|
}
|
|
],
|
|
"watermarks": [
|
|
{
|
|
"name": "avtx_wm",
|
|
"connection": "usmidsap02",
|
|
"resolver_sql": "SELECT COALESCE(MAX(avtstm)::timestamp - INTERVAL '7 days', TIMESTAMP '1900-01-01')::text FROM cms.avtx",
|
|
"default_value": "1900-01-01 00:00:00.000000"
|
|
}
|
|
],
|
|
"hooks": []
|
|
}
|