test stkt
This commit is contained in:
parent
d0e72e270f
commit
1d37f27573
317
config/modules/stkt.json
Normal file
317
config/modules/stkt.json
Normal file
@ -0,0 +1,317 @@
|
|||||||
|
{
|
||||||
|
"name": "stkt",
|
||||||
|
"source_connection": "S78030956",
|
||||||
|
"dest_connection": "usmidsap02",
|
||||||
|
"dest_table": "cms.stkt",
|
||||||
|
"staging_table": "pipekit_staging.stkt",
|
||||||
|
"merge_strategy": "incremental",
|
||||||
|
"merge_key": "byfsyy, byfspr",
|
||||||
|
"enabled": 1,
|
||||||
|
"dest_description": "Stock Transaction History 6.1",
|
||||||
|
"description": "Inventory stock transactions, current fiscal period forward",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"source_name": "BYPART",
|
||||||
|
"source_type": "CHAR(20)",
|
||||||
|
"dest_name": "bypart",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Part Number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYLOT",
|
||||||
|
"source_type": "CHAR(15)",
|
||||||
|
"dest_name": "bylot",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Lot Number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYSTOK",
|
||||||
|
"source_type": "CHAR(6)",
|
||||||
|
"dest_name": "bystok",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Stock Location"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYACTN",
|
||||||
|
"source_type": "CHAR(1)",
|
||||||
|
"dest_name": "byactn",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Act.Code I=Issue, R=Receipt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYQTY",
|
||||||
|
"source_type": "NUMERIC(15,5)",
|
||||||
|
"dest_name": "byqty",
|
||||||
|
"dest_type": "numeric(15,5)",
|
||||||
|
"description": "Quantity In Base Unit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYTDAT",
|
||||||
|
"source_type": "DATE",
|
||||||
|
"dest_name": "bytdat",
|
||||||
|
"dest_type": "date",
|
||||||
|
"description": "Transaction Date"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYJREF",
|
||||||
|
"source_type": "CHAR(13)",
|
||||||
|
"dest_name": "byjref",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Job Number Reference"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYIREF",
|
||||||
|
"source_type": "CHAR(20)",
|
||||||
|
"dest_name": "byiref",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Part Number Reference"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYLREF",
|
||||||
|
"source_type": "CHAR(15)",
|
||||||
|
"dest_name": "bylref",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Lot Number Reference"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYPREF",
|
||||||
|
"source_type": "CHAR(20)",
|
||||||
|
"dest_name": "bypref",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Project Reference"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYTRST",
|
||||||
|
"source_type": "CHAR(6)",
|
||||||
|
"dest_name": "bytrst",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Transfer Stock"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYTRAN",
|
||||||
|
"source_type": "NUMERIC(11,0)",
|
||||||
|
"dest_name": "bytran",
|
||||||
|
"dest_type": "numeric(11,0)",
|
||||||
|
"description": "Transaction #"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYSRC",
|
||||||
|
"source_type": "CHAR(3)",
|
||||||
|
"dest_name": "bysrc",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Source Code"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYREAS",
|
||||||
|
"source_type": "CHAR(3)",
|
||||||
|
"dest_name": "byreas",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Man. Inv. Reason Code"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYDREF",
|
||||||
|
"source_type": "CHAR(30)",
|
||||||
|
"dest_name": "bydref",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Ref Description"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYSEQ#",
|
||||||
|
"source_type": "NUMERIC(3,0)",
|
||||||
|
"dest_name": "byseq#",
|
||||||
|
"dest_type": "numeric(3,0)",
|
||||||
|
"description": "W.O. Sequence #"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYBUNT",
|
||||||
|
"source_type": "CHAR(3)",
|
||||||
|
"dest_name": "bybunt",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Base Unit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYTQTY",
|
||||||
|
"source_type": "NUMERIC(15,5)",
|
||||||
|
"dest_name": "bytqty",
|
||||||
|
"dest_type": "numeric(15,5)",
|
||||||
|
"description": "Trans. Quantity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYTUNT",
|
||||||
|
"source_type": "CHAR(3)",
|
||||||
|
"dest_name": "bytunt",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Trans. Unit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYA1",
|
||||||
|
"source_type": "CHAR(1)",
|
||||||
|
"dest_name": "bya1",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Transaction Type"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYPGQT",
|
||||||
|
"source_type": "NUMERIC(15,5)",
|
||||||
|
"dest_name": "bypgqt",
|
||||||
|
"dest_type": "numeric(15,5)",
|
||||||
|
"description": "Global Bal Prior to Tran"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYPSQT",
|
||||||
|
"source_type": "NUMERIC(15,5)",
|
||||||
|
"dest_name": "bypsqt",
|
||||||
|
"dest_type": "numeric(15,5)",
|
||||||
|
"description": "Stkrm Bal Prior to Tran"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYSDAT",
|
||||||
|
"source_type": "DATE",
|
||||||
|
"dest_name": "bysdat",
|
||||||
|
"dest_type": "date",
|
||||||
|
"description": "Date Stamp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYSTIM",
|
||||||
|
"source_type": "TIME",
|
||||||
|
"dest_name": "bystim",
|
||||||
|
"dest_type": "time",
|
||||||
|
"description": "Time Stamp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYUSER",
|
||||||
|
"source_type": "CHAR(10)",
|
||||||
|
"dest_name": "byuser",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "User ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFSYY",
|
||||||
|
"source_type": "NUMERIC(4,0)",
|
||||||
|
"dest_name": "byfsyy",
|
||||||
|
"dest_type": "numeric(4,0)",
|
||||||
|
"description": "Fiscal Year YY Future"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFSPR",
|
||||||
|
"source_type": "NUMERIC(2,0)",
|
||||||
|
"dest_name": "byfspr",
|
||||||
|
"dest_type": "numeric(2,0)",
|
||||||
|
"description": "Fiscal Period Future"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYPLNT",
|
||||||
|
"source_type": "CHAR(3)",
|
||||||
|
"dest_name": "byplnt",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Plant Code"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYTAG",
|
||||||
|
"source_type": "CHAR(15)",
|
||||||
|
"dest_name": "bytag",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Employee Tag Number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYBDEP",
|
||||||
|
"source_type": "CHAR(4)",
|
||||||
|
"dest_name": "bybdep",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Reference Business Department"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYRPNT",
|
||||||
|
"source_type": "CHAR(3)",
|
||||||
|
"dest_name": "byrpnt",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Reference Plant Code"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYTMZN",
|
||||||
|
"source_type": "CHAR(4)",
|
||||||
|
"dest_name": "bytmzn",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Trans Date Time Zone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYREFF",
|
||||||
|
"source_type": "CHAR(30)",
|
||||||
|
"dest_name": "byreff",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Reference Field"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFUT1A",
|
||||||
|
"source_type": "CHAR(10)",
|
||||||
|
"dest_name": "byfut1a",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Future Use"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFUT2A",
|
||||||
|
"source_type": "CHAR(10)",
|
||||||
|
"dest_name": "byfut2a",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Future Use"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFUT3A",
|
||||||
|
"source_type": "CHAR(10)",
|
||||||
|
"dest_name": "byfut3a",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Future Use"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFUT4A",
|
||||||
|
"source_type": "CHAR(20)",
|
||||||
|
"dest_name": "byfut4a",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Equipment Reference"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFUT5A",
|
||||||
|
"source_type": "CHAR(20)",
|
||||||
|
"dest_name": "byfut5a",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Future Use"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFUT6A",
|
||||||
|
"source_type": "CHAR(30)",
|
||||||
|
"dest_name": "byfut6a",
|
||||||
|
"dest_type": "text",
|
||||||
|
"description": "Future Use"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFUT1N",
|
||||||
|
"source_type": "NUMERIC(15,5)",
|
||||||
|
"dest_name": "byfut1n",
|
||||||
|
"dest_type": "numeric(15,5)",
|
||||||
|
"description": "Manu/Purc/Xfr Part - Standard Cost"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFUT2N",
|
||||||
|
"source_type": "NUMERIC(15,5)",
|
||||||
|
"dest_name": "byfut2n",
|
||||||
|
"dest_type": "numeric(15,5)",
|
||||||
|
"description": "Manual Inventory Transaction GL Account Used"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source_name": "BYFUT3N",
|
||||||
|
"source_type": "NUMERIC(15,5)",
|
||||||
|
"dest_name": "byfut3n",
|
||||||
|
"dest_type": "numeric(15,5)",
|
||||||
|
"description": "Future Use"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"watermarks": [
|
||||||
|
{
|
||||||
|
"name": "stkt_period",
|
||||||
|
"connection": "usmidsap02",
|
||||||
|
"resolver_sql": "SELECT CASE WHEN EXTRACT(MONTH FROM CURRENT_DATE) >= 6\n THEN (EXTRACT(YEAR FROM CURRENT_DATE) + 1) * 100 + (EXTRACT(MONTH FROM CURRENT_DATE) - 5)\n ELSE EXTRACT(YEAR FROM CURRENT_DATE) * 100 + (EXTRACT(MONTH FROM CURRENT_DATE) + 7)\n END::INT AS fiscal_period_key",
|
||||||
|
"default_value": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"hooks": []
|
||||||
|
}
|
||||||
48
config/modules/stkt.sql
Normal file
48
config/modules/stkt.sql
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
SELECT
|
||||||
|
RTRIM(BYPART) AS bypart,
|
||||||
|
RTRIM(BYLOT) AS bylot,
|
||||||
|
RTRIM(BYSTOK) AS bystok,
|
||||||
|
RTRIM(BYACTN) AS byactn,
|
||||||
|
BYQTY AS byqty,
|
||||||
|
CASE WHEN BYTDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE BYTDAT END AS bytdat,
|
||||||
|
RTRIM(BYJREF) AS byjref,
|
||||||
|
RTRIM(BYIREF) AS byiref,
|
||||||
|
RTRIM(BYLREF) AS bylref,
|
||||||
|
RTRIM(BYPREF) AS bypref,
|
||||||
|
RTRIM(BYTRST) AS bytrst,
|
||||||
|
BYTRAN AS bytran,
|
||||||
|
RTRIM(BYSRC) AS bysrc,
|
||||||
|
RTRIM(BYREAS) AS byreas,
|
||||||
|
RTRIM(BYDREF) AS bydref,
|
||||||
|
"BYSEQ#" AS "byseq#",
|
||||||
|
RTRIM(BYBUNT) AS bybunt,
|
||||||
|
BYTQTY AS bytqty,
|
||||||
|
RTRIM(BYTUNT) AS bytunt,
|
||||||
|
RTRIM(BYA1) AS bya1,
|
||||||
|
BYPGQT AS bypgqt,
|
||||||
|
BYPSQT AS bypsqt,
|
||||||
|
CASE WHEN BYSDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE BYSDAT END AS bysdat,
|
||||||
|
BYSTIM AS bystim,
|
||||||
|
RTRIM(BYUSER) AS byuser,
|
||||||
|
BYFSYY AS byfsyy,
|
||||||
|
BYFSPR AS byfspr,
|
||||||
|
RTRIM(BYPLNT) AS byplnt,
|
||||||
|
RTRIM(BYTAG) AS bytag,
|
||||||
|
RTRIM(BYBDEP) AS bybdep,
|
||||||
|
RTRIM(BYRPNT) AS byrpnt,
|
||||||
|
RTRIM(BYTMZN) AS bytmzn,
|
||||||
|
RTRIM(BYREFF) AS byreff,
|
||||||
|
RTRIM(BYFUT1A) AS byfut1a,
|
||||||
|
RTRIM(BYFUT2A) AS byfut2a,
|
||||||
|
RTRIM(BYFUT3A) AS byfut3a,
|
||||||
|
RTRIM(BYFUT4A) AS byfut4a,
|
||||||
|
RTRIM(BYFUT5A) AS byfut5a,
|
||||||
|
RTRIM(BYFUT6A) AS byfut6a,
|
||||||
|
BYFUT1N AS byfut1n,
|
||||||
|
BYFUT2N AS byfut2n,
|
||||||
|
BYFUT3N AS byfut3n
|
||||||
|
FROM LGDAT.STKT
|
||||||
|
WHERE BYFSYY BETWEEN 2000 AND 2030 -- drop corrupt out-of-range fiscal years
|
||||||
|
AND (BYFSYY > {stkt_period} / 100 -- split YYYYPP so the predicate stays
|
||||||
|
OR (BYFSYY = {stkt_period} / 100 -- sargable against STKTX10, whose
|
||||||
|
AND BYFSPR >= MOD({stkt_period}, 100))) -- leading key is FiscalYearPd
|
||||||
Loading…
Reference in New Issue
Block a user