load pncl

This commit is contained in:
Paul Trowbridge 2018-05-30 11:10:23 -04:00
parent 3f038d9592
commit 9d5a69c891
3 changed files with 104 additions and 0 deletions

29
reload/pncl/extract.sql Normal file
View File

@ -0,0 +1,29 @@
--transactions with date in download format for constraint
--transactions with date in download format for constraint
COPY
(
SELECT
r."Schedule#"
,to_char(r."PostDate",'mm/dd/yyyy') "Post Date"
,r."Assn#"
,r."Coll#"
,r."AdvanceRate"
,r."Sales"
,r."Credits & Adjustments"
,r."Gross Collections"
,r."CollateralBalance"
,r."MaxEligible"
,r."Ineligible Amount"
,r."Reserve Amount"
FROM
tps.trans
JOIN LATERAL jsonb_populate_record(NULL::tps.pncl, rec) r ON TRUE
WHERE
srce = 'PNCL'
)
TO 'C:\users\ptrowbridge\downloads\pncl.csv' WITH (format csv, header TRUE)
--source
SELECT DEFN FROM TPS.SRCE WHERE SRCE = 'PNCL'

2
reload/pncl/load.cmd Normal file
View File

@ -0,0 +1,2 @@
curl -H "Content-Type: application/json" -X POST -d@./srce.json http://localhost:81/srce_set
curl -v -F upload=@//mnt/c/Users/ptrowbridge/Downloads/pncl.csv http://localhost:81/import?srce=PNCL

73
reload/pncl/srce.json Normal file
View File

@ -0,0 +1,73 @@
{
"constraint": [
"{PostDate}",
"{Schedule#}"
],
"source": "client_file",
"loading_function": "csv",
"name": "PNCL",
"schemas": {
"default": [
{
"path": "{Schedule#}",
"type": "text",
"column_name": "Schedule#"
},
{
"type": "date",
"column_name": "PostDate",
"path": "{PostDate}"
},
{
"type": "text",
"column_name": "Assn#",
"path": "{Assn#}"
},
{
"type": "text",
"column_name": "Coll#",
"path": "{Coll#}"
},
{
"type": "numeric",
"column_name": "AdvanceRate",
"path": "{AdvanceRate}"
},
{
"type": "numeric",
"column_name": "Sales",
"path": "{Sales}"
},
{
"type": "numeric",
"column_name": "Credits & Adjustments",
"path": "{Credits & Adjustments}"
},
{
"type": "numeric",
"column_name": "Gross Collections",
"path": "{Gross Collections}"
},
{
"type": "numeric",
"column_name": "CollateralBalance",
"path": "{CollateralBalance}"
},
{
"type": "numeric",
"column_name": "MaxEligible",
"path": "{MaxEligible}"
},
{
"type": "numeric",
"column_name": "Ineligible Amount",
"path": "{Ineligible Amount}"
},
{
"type": "numeric",
"column_name": "Reserve Amount",
"path": "{Reserve Amount}"
}
]
}
}