diff --git a/reload/pncl/extract.sql b/reload/pncl/extract.sql new file mode 100644 index 0000000..0d3a6d7 --- /dev/null +++ b/reload/pncl/extract.sql @@ -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' + + diff --git a/reload/pncl/load.cmd b/reload/pncl/load.cmd new file mode 100644 index 0000000..19fdc66 --- /dev/null +++ b/reload/pncl/load.cmd @@ -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 \ No newline at end of file diff --git a/reload/pncl/srce.json b/reload/pncl/srce.json new file mode 100644 index 0000000..fffd0de --- /dev/null +++ b/reload/pncl/srce.json @@ -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}" + } + ] + } +} \ No newline at end of file