From 2986bb85c2d2bd0eafa442b617410cc6156c6ab6 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 11 Oct 2017 11:59:06 -0400 Subject: [PATCH 1/9] change ubm_schema from .backup to .sql --- ubm_schema.backup => ubm_schema.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ubm_schema.backup => ubm_schema.sql (100%) diff --git a/ubm_schema.backup b/ubm_schema.sql similarity index 100% rename from ubm_schema.backup rename to ubm_schema.sql From efd61f205a3d384a83a4de48c286b86131a241cd Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 11 Oct 2017 11:59:52 -0400 Subject: [PATCH 2/9] add COPY component --- srce.pgsql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/srce.pgsql b/srce.pgsql index 8af1773..4f49fdb 100644 --- a/srce.pgsql +++ b/srce.pgsql @@ -65,7 +65,7 @@ begin ----------------------------------------------------add create table verbage in front of column list-------------------------------------------------------- _t := format('CREATE TEMP TABLE csv_i (%s)', _t); - --raise notice '%', _t; + raise notice '%', _t; ----------------------------------------------------build the table----------------------------------------------------------------------------------------- @@ -77,4 +77,8 @@ begin end $$; -SELECT * FROM csv_i; \ No newline at end of file +--SELECT * FROM csv_i; + +COPY csv_i FROM 'C:\Users\ptrowbridge\downloads\transsearchcsv.csv' WITH (HEADER TRUE,DELIMITER ',', FORMAT CSV, ENCODING 'SQL_ASCII',QUOTE '"'); + +SELECT row_to_json(csv_i) FROM csv_i; \ No newline at end of file From 4cafbff49aa054655b7623d3514c1241abf5877f Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 11 Oct 2017 13:44:56 -0400 Subject: [PATCH 3/9] filter for single source and add insert to trans --- srce.pgsql | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/srce.pgsql b/srce.pgsql index 4f49fdb..783428f 100644 --- a/srce.pgsql +++ b/srce.pgsql @@ -59,6 +59,8 @@ begin TPS.srce --unwrap the schema definition array LEFT JOIN LATERAL jsonb_populate_recordset(null::tps.srce_defn_schema, defn->'schema') prs ON TRUE + WHERE + srce = 'PNCO' GROUP BY srce; @@ -79,6 +81,9 @@ $$; --SELECT * FROM csv_i; -COPY csv_i FROM 'C:\Users\ptrowbridge\downloads\transsearchcsv.csv' WITH (HEADER TRUE,DELIMITER ',', FORMAT CSV, ENCODING 'SQL_ASCII',QUOTE '"'); +COPY csv_i FROM 'C:\Users\ptrowbridge\Documents\OneDrive - The HC Companies, Inc\Cash\build_hist\full_dl\15Q1bal.csv' WITH (HEADER TRUE,DELIMITER ',', FORMAT CSV, ENCODING 'SQL_ASCII',QUOTE '"'); -SELECT row_to_json(csv_i) FROM csv_i; \ No newline at end of file +INSERT INTO + tps.trans (srce, rec) +SELECT + 'PNCO', row_to_json(csv_i) FROM csv_i; \ No newline at end of file From 6e6f03eaad6da99073cf6de6d3a6227f52fa2d05 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 11 Oct 2017 13:46:38 -0400 Subject: [PATCH 4/9] change dump folder --- ubm_backup.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ubm_backup.cmd b/ubm_backup.cmd index 52e2350..1725bb7 100644 --- a/ubm_backup.cmd +++ b/ubm_backup.cmd @@ -1,2 +1,2 @@ -"C:\PostgreSQL\pg10\bin\pg_dump" -h localhost -p 5433 -U ptrowbridge -d ubm -c -s -O -F p -f "C:\users\fleet\Documents\tps_etl\ubm_schema.backup" -"C:\PostgreSQL\pg10\bin\pg_dump" -h localhost -p 5433 -U ptrowbridge -d ubm --column-inserts -a -O -F p -f "C:\users\fleet\Documents\tps_etl\ubm_data.backup" \ No newline at end of file +"C:\PostgreSQL\pg10\bin\pg_dump" -h localhost -p 5433 -U ptrowbridge -d ubm -c -s -O -F p -f "C:\users\ptrowbridge\Documents\tps_etl\ubm_schema.backup" +"C:\PostgreSQL\pg10\bin\pg_dump" -h localhost -p 5433 -U ptrowbridge -d ubm --column-inserts -a -O -F p -f "C:\users\ptrowbridge\Documents\tps_etl\ubm_data.backup" \ No newline at end of file From f5cc765ab51709582194fe531e2448bb21adc212 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 11 Oct 2017 13:48:21 -0400 Subject: [PATCH 5/9] remove clean option and change extension to sql --- ubm_backup.cmd | 2 +- ubm_data.backup | 143 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 139 insertions(+), 6 deletions(-) diff --git a/ubm_backup.cmd b/ubm_backup.cmd index 1725bb7..710b1e4 100644 --- a/ubm_backup.cmd +++ b/ubm_backup.cmd @@ -1,2 +1,2 @@ -"C:\PostgreSQL\pg10\bin\pg_dump" -h localhost -p 5433 -U ptrowbridge -d ubm -c -s -O -F p -f "C:\users\ptrowbridge\Documents\tps_etl\ubm_schema.backup" +"C:\PostgreSQL\pg10\bin\pg_dump" -h localhost -p 5433 -U ptrowbridge -d ubm -s -O -F p -f "C:\users\ptrowbridge\Documents\tps_etl\ubm_schema.sql" "C:\PostgreSQL\pg10\bin\pg_dump" -h localhost -p 5433 -U ptrowbridge -d ubm --column-inserts -a -O -F p -f "C:\users\ptrowbridge\Documents\tps_etl\ubm_data.backup" \ No newline at end of file diff --git a/ubm_data.backup b/ubm_data.backup index 094d8e9..4a66cac 100644 --- a/ubm_data.backup +++ b/ubm_data.backup @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 10beta4 --- Dumped by pg_dump version 10beta4 +-- Dumped from database version 10rc1 +-- Dumped by pg_dump version 10rc1 SET statement_timeout = 0; SET lock_timeout = 0; @@ -20,7 +20,6 @@ SET search_path = evt, pg_catalog; -- Data for Name: log; Type: TABLE DATA; Schema: evt; Owner: - -- -INSERT INTO log (id, rec) VALUES (1, '{"date": "2017-08-20", "item": [{"item": "Green Chili", "amount": 1.49, "account": "food"}, {"item": "Black Beans", "amount": 1.6, "account": "food"}, {"item": "Distilled Water", "amount": 7.12, "account": "food"}, {"item": "Fruit Preservative", "amount": 3.99, "account": "food"}, {"item": "Watch Battery", "amount": 3.79, "account": "stuff"}, {"item": "Sales Tax", "amount": "0.26", "account": "taxes"}, {"item": "Green Chili", "amount": -1.49, "account": "dcard"}, {"item": "Black Beans", "amount": -1.6, "account": "dcard"}, {"item": "Distilled Water", "amount": -7.12, "account": "dcard"}, {"item": "Fruit Preservative", "amount": -3.99, "account": "dcard"}, {"item": "Watch Battery", "amount": -3.79, "account": "dcard"}, {"item": "Sales Tax", "amount": -0.26, "account": "dcard"}], "vendor": "Drug Mart", "instrument": "Discover Card"}'); SET search_path = tps, pg_catalog; @@ -29,7 +28,132 @@ SET search_path = tps, pg_catalog; -- Data for Name: srce; Type: TABLE DATA; Schema: tps; Owner: - -- -INSERT INTO srce (srce, defn) VALUES ('PNCC', '{"name": "PNCC", "type": "csv", "schema": [{"key": "AsOfDate", "type": "date"}, {"key": "BankId", "type": "text"}, {"key": "AccountNumber", "type": "text"}, {"key": "AccountName", "type": "text"}, {"key": "BaiControl", "type": "text"}, {"key": "Currency", "type": "text"}, {"key": "Transaction", "type": "text"}, {"key": "Reference", "type": "text"}, {"key": "Amount", "type": "text"}, {"key": "Description", "type": "text"}, {"key": "AdditionalRemittance", "type": "text"}], "unique_constraint": {"type": "range", "fields": ["{AsOfDate}"]}}'); +INSERT INTO srce (srce, defn) VALUES ('PNCC', '{"name": "PNCC", "type": "csv", "descr": "PNC Cash Accounts", "schema": [{"key": "AsOfDate", "type": "date"}, {"key": "BankId", "type": "text"}, {"key": "AccountNumber", "type": "text"}, {"key": "AccountName", "type": "text"}, {"key": "BaiControl", "type": "text"}, {"key": "Currency", "type": "text"}, {"key": "Transaction", "type": "text"}, {"key": "Reference", "type": "text"}, {"key": "Amount", "type": "text"}, {"key": "Description", "type": "text"}, {"key": "AdditionalRemittance", "type": "text"}], "unique_constraint": {"type": "range", "fields": ["{AsOfDate}"]}}'); +INSERT INTO srce (srce, defn) VALUES ('PNCO', '{"name": "PNCO", "type": "csv", "descr": "PNC Loan Ledger", "schema": [{"key": "Loan#", "type": "text"}, {"key": "Post Date", "type": "date"}, {"key": "Effective Date", "type": "date"}, {"key": "Reference #", "type": "text"}, {"key": "Description", "type": "text"}, {"key": "Advances", "type": "numeric"}, {"key": "Adjustments", "type": "numeric"}, {"key": "Payments", "type": "numeric"}, {"key": "Loan Balance", "type": "numeric"}], "unique_constraint": {"type": "range", "fields": ["{Post Date}"]}}'); + + +-- +-- Data for Name: trans; Type: TABLE DATA; Schema: tps; Owner: - +-- + +INSERT INTO trans (id, srce, rec, map) VALUES (2, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-13", "Adjustments": 0.00, "Description": "", "Reference #": "240871559", "Loan Balance": 0.00, "Effective Date": "2015-02-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (3, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-13", "Adjustments": 0.00, "Description": "", "Reference #": "240871557", "Loan Balance": 0.00, "Effective Date": "2015-02-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (4, 'PNCO', '{"Loan#": "606780191", "Advances": 27992.25, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016556", "Loan Balance": 27992.25, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (5, 'PNCO', '{"Loan#": "606780191", "Advances": 8000.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016551", "Loan Balance": 35992.25, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (6, 'PNCO', '{"Loan#": "606780191", "Advances": 1656860.21, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016546", "Loan Balance": 1692852.46, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (7, 'PNCO', '{"Loan#": "606780191", "Advances": 2233.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016541", "Loan Balance": 1695085.46, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (8, 'PNCO', '{"Loan#": "606780191", "Advances": 17000.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016536", "Loan Balance": 1712085.46, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (9, 'PNCO', '{"Loan#": "606780191", "Advances": 2535261.04, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016531", "Loan Balance": 4247346.50, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (10, 'PNCO', '{"Loan#": "606780191", "Advances": 25919.62, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016526", "Loan Balance": 4273266.12, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (11, 'PNCO', '{"Loan#": "606780191", "Advances": 4581.25, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016521", "Loan Balance": 4277847.37, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (12, 'PNCO', '{"Loan#": "606780191", "Advances": 90000.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016516", "Loan Balance": 4367847.37, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (13, 'PNCO', '{"Loan#": "606780191", "Advances": 1000000.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016511", "Loan Balance": 5367847.37, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (14, 'PNCO', '{"Loan#": "606780191", "Advances": 6280808.31, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016506", "Loan Balance": 11648655.68, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (15, 'PNCO', '{"Loan#": "606780191", "Advances": 11275.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016501", "Loan Balance": 11659930.68, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (16, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 20000000.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016496", "Loan Balance": -8340069.32, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (17, 'PNCO', '{"Loan#": "606780191", "Advances": 720000.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016491", "Loan Balance": -7620069.32, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (18, 'PNCO', '{"Loan#": "606780191", "Advances": 118449.84, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016486", "Loan Balance": -7501619.48, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (19, 'PNCO', '{"Loan#": "606780191", "Advances": 100000.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016481", "Loan Balance": -7401619.48, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (20, 'PNCO', '{"Loan#": "606780191", "Advances": 148449.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016476", "Loan Balance": -7253170.48, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (21, 'PNCO', '{"Loan#": "606780191", "Advances": 21585.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016471", "Loan Balance": -7231585.48, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (22, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 30873305.71, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016466", "Loan Balance": -38104891.19, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (23, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 647868.87, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016461", "Loan Balance": -38752760.06, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (24, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 1095801.30, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016456", "Loan Balance": -39848561.36, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (25, 'PNCO', '{"Loan#": "606780191", "Advances": 165000.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016451", "Loan Balance": -39683561.36, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (26, 'PNCO', '{"Loan#": "606780191", "Advances": 20127.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016446", "Loan Balance": -39663434.36, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (27, 'PNCO', '{"Loan#": "606780191", "Advances": 8625000.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016441", "Loan Balance": -31038434.36, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (28, 'PNCO', '{"Loan#": "606780191", "Advances": 2500.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016436", "Loan Balance": -31035934.36, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (29, 'PNCO', '{"Loan#": "606780191", "Advances": 2500.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016431", "Loan Balance": -31033434.36, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (30, 'PNCO', '{"Loan#": "606780191", "Advances": 63505950.65, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016426", "Loan Balance": 32472516.29, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (31, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "240990470", "Loan Balance": 32472516.29, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (32, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 526831.23, "Post Date": "2015-02-20", "Adjustments": 0.00, "Description": "", "Reference #": "241372087", "Loan Balance": 31945685.06, "Effective Date": "2015-02-20"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (33, 'PNCO', '{"Loan#": "606780191", "Advances": 175000.00, "Payments": 0.00, "Post Date": "2015-02-20", "Adjustments": 0.00, "Description": "", "Reference #": "241372082", "Loan Balance": 32120685.06, "Effective Date": "2015-02-20"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (34, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 377629.52, "Post Date": "2015-02-23", "Adjustments": 0.00, "Description": "", "Reference #": "241489522", "Loan Balance": 31743055.54, "Effective Date": "2015-02-23"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (35, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 481204.25, "Post Date": "2015-02-24", "Adjustments": 0.00, "Description": "", "Reference #": "241609117", "Loan Balance": 31261851.29, "Effective Date": "2015-02-24"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (36, 'PNCO', '{"Loan#": "606780191", "Advances": 1963839.00, "Payments": 0.00, "Post Date": "2015-02-24", "Adjustments": 0.00, "Description": "", "Reference #": "241609112", "Loan Balance": 33225690.29, "Effective Date": "2015-02-24"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (37, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 963062.01, "Post Date": "2015-02-25", "Adjustments": 0.00, "Description": "", "Reference #": "241748333", "Loan Balance": 32262628.28, "Effective Date": "2015-02-25"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (38, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 71500.00, "Post Date": "2015-02-26", "Adjustments": 0.00, "Description": "", "Reference #": "241856901", "Loan Balance": 32191128.28, "Effective Date": "2015-02-26"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (39, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 928834.96, "Post Date": "2015-02-26", "Adjustments": 0.00, "Description": "", "Reference #": "241856896", "Loan Balance": 31262293.32, "Effective Date": "2015-02-26"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (40, 'PNCO', '{"Loan#": "606780191", "Advances": 15742.26, "Payments": 0.00, "Post Date": "2015-02-27", "Adjustments": 0.00, "Description": "", "Reference #": "241979563", "Loan Balance": 31278035.58, "Effective Date": "2015-02-27"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (41, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 93093.63, "Post Date": "2015-02-27", "Adjustments": 0.00, "Description": "", "Reference #": "241979558", "Loan Balance": 31184941.95, "Effective Date": "2015-02-27"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (42, 'PNCO', '{"Loan#": "606780191", "Advances": 3150.00, "Payments": 0.00, "Post Date": "2015-02-27", "Adjustments": 0.00, "Description": "", "Reference #": "241979553", "Loan Balance": 31188091.95, "Effective Date": "2015-02-27"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (43, 'PNCO', '{"Loan#": "606780191", "Advances": 71500.00, "Payments": 0.00, "Post Date": "2015-02-27", "Adjustments": 0.00, "Description": "", "Reference #": "241979548", "Loan Balance": 31259591.95, "Effective Date": "2015-02-27"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (44, 'PNCO', '{"Loan#": "606780191", "Advances": 608.33, "Payments": 0.00, "Post Date": "2015-03-02", "Adjustments": 0.00, "Description": "", "Reference #": "242146434", "Loan Balance": 31260200.28, "Effective Date": "2015-03-02"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (45, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 750360.24, "Post Date": "2015-03-02", "Adjustments": 0.00, "Description": "", "Reference #": "242146429", "Loan Balance": 30509840.04, "Effective Date": "2015-03-02"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (46, 'PNCO', '{"Loan#": "606780191", "Advances": 125000.00, "Payments": 0.00, "Post Date": "2015-03-02", "Adjustments": 0.00, "Description": "", "Reference #": "242146424", "Loan Balance": 30634840.04, "Effective Date": "2015-03-02"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (47, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-03-02", "Adjustments": 0.00, "Description": "", "Reference #": "242146421", "Loan Balance": 30634840.04, "Effective Date": "2015-03-02"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (48, 'PNCO', '{"Loan#": "606780191", "Advances": 39722.22, "Payments": 0.00, "Post Date": "2015-03-02", "Adjustments": 0.00, "Description": "", "Reference #": "242146416", "Loan Balance": 30674562.26, "Effective Date": "2015-03-02"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (49, 'PNCO', '{"Loan#": "606780191", "Advances": 54895.76, "Payments": 0.00, "Post Date": "2015-03-02", "Adjustments": 0.00, "Description": "", "Reference #": "242146411", "Loan Balance": 30729458.02, "Effective Date": "2015-03-02"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (50, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 388182.11, "Post Date": "2015-03-03", "Adjustments": 0.00, "Description": "", "Reference #": "242376851", "Loan Balance": 30341275.91, "Effective Date": "2015-03-03"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (51, 'PNCO', '{"Loan#": "606780191", "Advances": 2758322.00, "Payments": 0.00, "Post Date": "2015-03-03", "Adjustments": 0.00, "Description": "", "Reference #": "242376846", "Loan Balance": 33099597.91, "Effective Date": "2015-03-03"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (52, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 604637.39, "Post Date": "2015-03-04", "Adjustments": 0.00, "Description": "", "Reference #": "242488845", "Loan Balance": 32494960.52, "Effective Date": "2015-03-04"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (53, 'PNCO', '{"Loan#": "606780191", "Advances": 444000.00, "Payments": 0.00, "Post Date": "2015-03-04", "Adjustments": 0.00, "Description": "", "Reference #": "242488840", "Loan Balance": 32938960.52, "Effective Date": "2015-03-04"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (54, 'PNCO', '{"Loan#": "606780191", "Advances": 226000.00, "Payments": 0.00, "Post Date": "2015-03-05", "Adjustments": 0.00, "Description": "", "Reference #": "242600430", "Loan Balance": 33164960.52, "Effective Date": "2015-03-05"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (55, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 1028329.75, "Post Date": "2015-03-06", "Adjustments": 0.00, "Description": "", "Reference #": "242708090", "Loan Balance": 32136630.77, "Effective Date": "2015-03-06"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (56, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-03-09", "Adjustments": -25000000.00, "Description": "", "Reference #": "242812271", "Loan Balance": 7136630.77, "Effective Date": "2015-03-06"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (57, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 304435.57, "Post Date": "2015-03-09", "Adjustments": 0.00, "Description": "", "Reference #": "242825473", "Loan Balance": 6832195.20, "Effective Date": "2015-03-09"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (58, 'PNCO', '{"Loan#": "606780191", "Advances": 210464.46, "Payments": 0.00, "Post Date": "2015-03-09", "Adjustments": 0.00, "Description": "", "Reference #": "242825468", "Loan Balance": 7042659.66, "Effective Date": "2015-03-09"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (59, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 908124.34, "Post Date": "2015-03-10", "Adjustments": 0.00, "Description": "", "Reference #": "242947218", "Loan Balance": 6134535.32, "Effective Date": "2015-03-10"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (60, 'PNCO', '{"Loan#": "606780191", "Advances": 24905.07, "Payments": 0.00, "Post Date": "2015-03-10", "Adjustments": 0.00, "Description": "", "Reference #": "242947213", "Loan Balance": 6159440.39, "Effective Date": "2015-03-10"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (61, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 927081.96, "Post Date": "2015-03-11", "Adjustments": 0.00, "Description": "", "Reference #": "243061937", "Loan Balance": 5232358.43, "Effective Date": "2015-03-11"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (62, 'PNCO', '{"Loan#": "606780191", "Advances": 3095988.00, "Payments": 0.00, "Post Date": "2015-03-11", "Adjustments": 0.00, "Description": "", "Reference #": "243061932", "Loan Balance": 8328346.43, "Effective Date": "2015-03-11"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (63, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 76272.73, "Post Date": "2015-03-12", "Adjustments": 0.00, "Description": "", "Reference #": "243178426", "Loan Balance": 8252073.70, "Effective Date": "2015-03-12"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (64, 'PNCO', '{"Loan#": "606780191", "Advances": 106300.00, "Payments": 0.00, "Post Date": "2015-03-12", "Adjustments": 0.00, "Description": "", "Reference #": "243178421", "Loan Balance": 8358373.70, "Effective Date": "2015-03-12"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (65, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 101648.46, "Post Date": "2015-03-13", "Adjustments": 0.00, "Description": "", "Reference #": "243288682", "Loan Balance": 8256725.24, "Effective Date": "2015-03-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (66, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 350.00, "Post Date": "2015-03-16", "Adjustments": 0.00, "Description": "", "Reference #": "243408568", "Loan Balance": 8256375.24, "Effective Date": "2015-03-16"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (67, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 385774.81, "Post Date": "2015-03-16", "Adjustments": 0.00, "Description": "", "Reference #": "243408563", "Loan Balance": 7870600.43, "Effective Date": "2015-03-16"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (68, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 232042.23, "Post Date": "2015-03-16", "Adjustments": 0.00, "Description": "", "Reference #": "243408558", "Loan Balance": 7638558.20, "Effective Date": "2015-03-16"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (69, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 90853.40, "Post Date": "2015-03-17", "Adjustments": 0.00, "Description": "", "Reference #": "243546995", "Loan Balance": 7547704.80, "Effective Date": "2015-03-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (70, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 1100373.44, "Post Date": "2015-03-17", "Adjustments": 0.00, "Description": "", "Reference #": "243546990", "Loan Balance": 6447331.36, "Effective Date": "2015-03-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (71, 'PNCO', '{"Loan#": "606780191", "Advances": 1750223.00, "Payments": 0.00, "Post Date": "2015-03-17", "Adjustments": 0.00, "Description": "", "Reference #": "243546985", "Loan Balance": 8197554.36, "Effective Date": "2015-03-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (72, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 874291.47, "Post Date": "2015-03-18", "Adjustments": 0.00, "Description": "", "Reference #": "243664486", "Loan Balance": 7323262.89, "Effective Date": "2015-03-18"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (73, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 526443.58, "Post Date": "2015-03-18", "Adjustments": 0.00, "Description": "", "Reference #": "243664481", "Loan Balance": 6796819.31, "Effective Date": "2015-03-18"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (74, 'PNCO', '{"Loan#": "606780191", "Advances": 928418.71, "Payments": 0.00, "Post Date": "2015-03-18", "Adjustments": 0.00, "Description": "", "Reference #": "243664476", "Loan Balance": 7725238.02, "Effective Date": "2015-03-18"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (75, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 2809.94, "Post Date": "2015-03-19", "Adjustments": 0.00, "Description": "", "Reference #": "243772989", "Loan Balance": 7722428.08, "Effective Date": "2015-03-19"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (76, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 727091.26, "Post Date": "2015-03-19", "Adjustments": 0.00, "Description": "", "Reference #": "243772984", "Loan Balance": 6995336.82, "Effective Date": "2015-03-19"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (77, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 177215.75, "Post Date": "2015-03-20", "Adjustments": 0.00, "Description": "", "Reference #": "243877202", "Loan Balance": 6818121.07, "Effective Date": "2015-03-20"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (78, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 186772.26, "Post Date": "2015-03-20", "Adjustments": 0.00, "Description": "", "Reference #": "243877197", "Loan Balance": 6631348.81, "Effective Date": "2015-03-20"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (79, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 78218.74, "Post Date": "2015-03-23", "Adjustments": 0.00, "Description": "", "Reference #": "243990906", "Loan Balance": 6553130.07, "Effective Date": "2015-03-23"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (80, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 225525.95, "Post Date": "2015-03-23", "Adjustments": 0.00, "Description": "", "Reference #": "243990901", "Loan Balance": 6327604.12, "Effective Date": "2015-03-23"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (81, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 69784.36, "Post Date": "2015-03-23", "Adjustments": 0.00, "Description": "", "Reference #": "243990896", "Loan Balance": 6257819.76, "Effective Date": "2015-03-23"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (82, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 879711.41, "Post Date": "2015-03-24", "Adjustments": 0.00, "Description": "", "Reference #": "244114417", "Loan Balance": 5378108.35, "Effective Date": "2015-03-24"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (83, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 41213.54, "Post Date": "2015-03-24", "Adjustments": 0.00, "Description": "", "Reference #": "244114412", "Loan Balance": 5336894.81, "Effective Date": "2015-03-24"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (84, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 230755.54, "Post Date": "2015-03-24", "Adjustments": 0.00, "Description": "", "Reference #": "244114407", "Loan Balance": 5106139.27, "Effective Date": "2015-03-24"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (85, 'PNCO', '{"Loan#": "606780191", "Advances": 3877213.00, "Payments": 0.00, "Post Date": "2015-03-24", "Adjustments": 0.00, "Description": "", "Reference #": "244114402", "Loan Balance": 8983352.27, "Effective Date": "2015-03-24"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (86, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 226129.00, "Post Date": "2015-03-25", "Adjustments": 0.00, "Description": "", "Reference #": "244220348", "Loan Balance": 8757223.27, "Effective Date": "2015-03-25"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (87, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 316633.43, "Post Date": "2015-03-25", "Adjustments": 0.00, "Description": "", "Reference #": "244220343", "Loan Balance": 8440589.84, "Effective Date": "2015-03-25"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (88, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 655688.78, "Post Date": "2015-03-26", "Adjustments": 0.00, "Description": "", "Reference #": "244330144", "Loan Balance": 7784901.06, "Effective Date": "2015-03-26"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (89, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 322217.94, "Post Date": "2015-03-26", "Adjustments": 0.00, "Description": "", "Reference #": "244330139", "Loan Balance": 7462683.12, "Effective Date": "2015-03-26"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (90, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 45600.92, "Post Date": "2015-03-27", "Adjustments": 0.00, "Description": "", "Reference #": "244472455", "Loan Balance": 7417082.20, "Effective Date": "2015-03-27"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (91, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 29545.69, "Post Date": "2015-03-27", "Adjustments": 0.00, "Description": "", "Reference #": "244472450", "Loan Balance": 7387536.51, "Effective Date": "2015-03-27"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (92, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 8500.38, "Post Date": "2015-03-27", "Adjustments": 0.00, "Description": "", "Reference #": "244472445", "Loan Balance": 7379036.13, "Effective Date": "2015-03-27"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (93, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 162414.01, "Post Date": "2015-03-30", "Adjustments": 0.00, "Description": "", "Reference #": "244588483", "Loan Balance": 7216622.12, "Effective Date": "2015-03-30"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (94, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 153618.23, "Post Date": "2015-03-30", "Adjustments": 0.00, "Description": "", "Reference #": "244588478", "Loan Balance": 7063003.89, "Effective Date": "2015-03-30"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (95, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 74556.66, "Post Date": "2015-03-30", "Adjustments": 0.00, "Description": "", "Reference #": "244588473", "Loan Balance": 6988447.23, "Effective Date": "2015-03-30"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (96, 'PNCO', '{"Loan#": "606780191", "Advances": 75000.00, "Payments": 0.00, "Post Date": "2015-03-30", "Adjustments": 0.00, "Description": "", "Reference #": "244588468", "Loan Balance": 7063447.23, "Effective Date": "2015-03-30"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (97, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 1462007.22, "Post Date": "2015-03-31", "Adjustments": 0.00, "Description": "", "Reference #": "244782046", "Loan Balance": 5601440.01, "Effective Date": "2015-03-31"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (98, 'PNCO', '{"Loan#": "606780191", "Advances": 0.00, "Payments": 197734.52, "Post Date": "2015-03-31", "Adjustments": 0.00, "Description": "", "Reference #": "244782041", "Loan Balance": 5403705.49, "Effective Date": "2015-03-31"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (99, 'PNCO', '{"Loan#": "606780191", "Advances": 3737051.00, "Payments": 0.00, "Post Date": "2015-03-31", "Adjustments": 0.00, "Description": "", "Reference #": "244782036", "Loan Balance": 9140756.49, "Effective Date": "2015-03-31"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (100, 'PNCO', '{"Loan#": "606780206", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-13", "Adjustments": 0.00, "Description": "", "Reference #": "240871723", "Loan Balance": 0.00, "Effective Date": "2015-02-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (101, 'PNCO', '{"Loan#": "606780206", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-13", "Adjustments": 0.00, "Description": "", "Reference #": "240871725", "Loan Balance": 0.00, "Effective Date": "2015-02-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (102, 'PNCO', '{"Loan#": "606780206", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "240990522", "Loan Balance": 0.00, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (103, 'PNCO', '{"Loan#": "606780214", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-13", "Adjustments": 0.00, "Description": "", "Reference #": "240871891", "Loan Balance": 0.00, "Effective Date": "2015-02-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (104, 'PNCO', '{"Loan#": "606780214", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-13", "Adjustments": 0.00, "Description": "", "Reference #": "240871889", "Loan Balance": 0.00, "Effective Date": "2015-02-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (105, 'PNCO', '{"Loan#": "606780214", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "240990558", "Loan Balance": 0.00, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (106, 'PNCO', '{"Loan#": "606780214", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-03-09", "Adjustments": 0.00, "Description": "", "Reference #": "242812278", "Loan Balance": 0.00, "Effective Date": "2015-03-06"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (107, 'PNCO', '{"Loan#": "606780214", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-03-09", "Adjustments": 25000000.00, "Description": "", "Reference #": "242812280", "Loan Balance": 25000000.00, "Effective Date": "2015-03-06"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (108, 'PNCO', '{"Loan#": "606780275", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-13", "Adjustments": 0.00, "Description": "", "Reference #": "240873773", "Loan Balance": 0.00, "Effective Date": "2015-02-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (109, 'PNCO', '{"Loan#": "606780275", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-13", "Adjustments": 0.00, "Description": "", "Reference #": "240873771", "Loan Balance": 0.00, "Effective Date": "2015-02-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (110, 'PNCO', '{"Loan#": "606780275", "Advances": 20000000.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "241016561", "Loan Balance": 20000000.00, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (111, 'PNCO', '{"Loan#": "606780275", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "240990781", "Loan Balance": 20000000.00, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (112, 'PNCO', '{"Loan#": "606780275", "Advances": 0.00, "Payments": 125000.00, "Post Date": "2015-03-02", "Adjustments": 0.00, "Description": "", "Reference #": "242146442", "Loan Balance": 19875000.00, "Effective Date": "2015-03-02"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (113, 'PNCO', '{"Loan#": "606780275", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-03-02", "Adjustments": 0.00, "Description": "", "Reference #": "242146439", "Loan Balance": 19875000.00, "Effective Date": "2015-03-02"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (114, 'PNCO', '{"Loan#": "606780275", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-03-09", "Adjustments": -19500000.00, "Description": "", "Reference #": "242813139", "Loan Balance": 375000.00, "Effective Date": "2015-03-06"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (115, 'PNCO', '{"Loan#": "606780281", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-13", "Adjustments": 0.00, "Description": "", "Reference #": "240874075", "Loan Balance": 0.00, "Effective Date": "2015-02-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (116, 'PNCO', '{"Loan#": "606780281", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-13", "Adjustments": 0.00, "Description": "", "Reference #": "240874073", "Loan Balance": 0.00, "Effective Date": "2015-02-13"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (117, 'PNCO', '{"Loan#": "606780281", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-02-17", "Adjustments": 0.00, "Description": "", "Reference #": "240991019", "Loan Balance": 0.00, "Effective Date": "2015-02-17"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (118, 'PNCO', '{"Loan#": "606780281", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-03-09", "Adjustments": 19500000.00, "Description": "", "Reference #": "242813148", "Loan Balance": 19500000.00, "Effective Date": "2015-03-06"}', NULL); +INSERT INTO trans (id, srce, rec, map) VALUES (119, 'PNCO', '{"Loan#": "606780281", "Advances": 0.00, "Payments": 0.00, "Post Date": "2015-03-09", "Adjustments": 0.00, "Description": "", "Reference #": "242813146", "Loan Balance": 19500000.00, "Effective Date": "2015-03-06"}', NULL); SET search_path = evt, pg_catalog; @@ -38,7 +162,16 @@ SET search_path = evt, pg_catalog; -- Name: log_id_seq; Type: SEQUENCE SET; Schema: evt; Owner: - -- -SELECT pg_catalog.setval('log_id_seq', 1, true); +SELECT pg_catalog.setval('log_id_seq', 1, false); + + +SET search_path = tps, pg_catalog; + +-- +-- Name: trans_id_seq; Type: SEQUENCE SET; Schema: tps; Owner: - +-- + +SELECT pg_catalog.setval('trans_id_seq', 119, true); -- From 0a5f40ca1fc270b807ad1e3c6453bcc51ebedfc9 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 11 Oct 2017 13:50:13 -0400 Subject: [PATCH 6/9] get rid of deletes, add trans table --- ubm_schema.sql | 80 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 32 deletions(-) diff --git a/ubm_schema.sql b/ubm_schema.sql index e640e3c..3e04f5f 100644 --- a/ubm_schema.sql +++ b/ubm_schema.sql @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 10beta4 --- Dumped by pg_dump version 10beta4 +-- Dumped from database version 10rc1 +-- Dumped by pg_dump version 10rc1 SET statement_timeout = 0; SET lock_timeout = 0; @@ -14,25 +14,6 @@ SET check_function_bodies = false; SET client_min_messages = warning; SET row_security = off; -SET search_path = tps, pg_catalog; - -ALTER TABLE ONLY tps.srce DROP CONSTRAINT srce_pkey; -SET search_path = evt, pg_catalog; - -ALTER TABLE ONLY evt.log DROP CONSTRAINT log_pkey; -SET search_path = tps, pg_catalog; - -DROP TABLE tps.srce; -SET search_path = evt, pg_catalog; - -DROP TABLE evt.log; -SET search_path = tps, pg_catalog; - -DROP TYPE tps.srce_defn_schema; -DROP EXTENSION plpgsql; -DROP SCHEMA tps; -DROP SCHEMA public; -DROP SCHEMA evt; -- -- Name: evt; Type: SCHEMA; Schema: -; Owner: - -- @@ -41,17 +22,10 @@ CREATE SCHEMA evt; -- --- Name: public; Type: SCHEMA; Schema: -; Owner: - +-- Name: SCHEMA evt; Type: COMMENT; Schema: -; Owner: - -- -CREATE SCHEMA public; - - --- --- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON SCHEMA public IS 'standard public schema'; +COMMENT ON SCHEMA evt IS 'events'; -- @@ -61,6 +35,13 @@ COMMENT ON SCHEMA public IS 'standard public schema'; CREATE SCHEMA tps; +-- +-- Name: SCHEMA tps; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON SCHEMA tps IS 'third party source'; + + -- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - -- @@ -129,6 +110,32 @@ CREATE TABLE srce ( ); +-- +-- Name: trans; Type: TABLE; Schema: tps; Owner: - +-- + +CREATE TABLE trans ( + id integer NOT NULL, + srce text, + rec jsonb, + map jsonb +); + + +-- +-- Name: trans_id_seq; Type: SEQUENCE; Schema: tps; Owner: - +-- + +ALTER TABLE trans ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME trans_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + + SET search_path = evt, pg_catalog; -- @@ -150,10 +157,19 @@ ALTER TABLE ONLY srce -- --- Name: public; Type: ACL; Schema: -; Owner: - +-- Name: trans trans_pkey; Type: CONSTRAINT; Schema: tps; Owner: - -- -GRANT ALL ON SCHEMA public TO PUBLIC; +ALTER TABLE ONLY trans + ADD CONSTRAINT trans_pkey PRIMARY KEY (id); + + +-- +-- Name: trans trans_srce_fkey; Type: FK CONSTRAINT; Schema: tps; Owner: - +-- + +ALTER TABLE ONLY trans + ADD CONSTRAINT trans_srce_fkey FOREIGN KEY (srce) REFERENCES srce(srce); -- From 76094b5fadb9044068fcae50e8ac01a930d2e14b Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 13 Oct 2017 02:52:58 -0400 Subject: [PATCH 7/9] change extension to sql --- ubm_data.backup => ubm_data.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ubm_data.backup => ubm_data.sql (100%) diff --git a/ubm_data.backup b/ubm_data.sql similarity index 100% rename from ubm_data.backup rename to ubm_data.sql From 78ebfd5e8f4db447ae6ccb2ef0c17c4921a285c6 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 13 Oct 2017 02:53:21 -0400 Subject: [PATCH 8/9] change out to sql extension --- ubm_backup.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubm_backup.cmd b/ubm_backup.cmd index 710b1e4..3d120ca 100644 --- a/ubm_backup.cmd +++ b/ubm_backup.cmd @@ -1,2 +1,2 @@ "C:\PostgreSQL\pg10\bin\pg_dump" -h localhost -p 5433 -U ptrowbridge -d ubm -s -O -F p -f "C:\users\ptrowbridge\Documents\tps_etl\ubm_schema.sql" -"C:\PostgreSQL\pg10\bin\pg_dump" -h localhost -p 5433 -U ptrowbridge -d ubm --column-inserts -a -O -F p -f "C:\users\ptrowbridge\Documents\tps_etl\ubm_data.backup" \ No newline at end of file +"C:\PostgreSQL\pg10\bin\pg_dump" -h localhost -p 5433 -U ptrowbridge -d ubm --column-inserts -a -O -F p -f "C:\users\ptrowbridge\Documents\tps_etl\ubm_data.sql" \ No newline at end of file From e560e496863ccded312f4d404890e79651ec65e0 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 13 Oct 2017 02:55:28 -0400 Subject: [PATCH 9/9] get rid of commented out sample json --- srce.pgsql | 45 --------------------------------------------- 1 file changed, 45 deletions(-) diff --git a/srce.pgsql b/srce.pgsql index 783428f..beaa58a 100644 --- a/srce.pgsql +++ b/srce.pgsql @@ -1,48 +1,3 @@ -/* -SELECT -jsonb_pretty( -$$ -{ - "name": "GOOGDM", - "type": "json_csv", - "schema": { - "rows": [ - { - "elements": [ - { - "status": "text", - "distance": { - "text": "text", - "value": "numeric" - }, - "duration": { - "text": "text", - "value": "value" - } - } - ] - } - ], - "status": "text", - "origin_addresses": [ - "text" - ], - "destination_addresses": [ - "text" - ] - }, - "unique_constraint": { - "type": "key", - "fields": [ - "{origin_adresses,0}", - "{destination_adresses,0}" - ] - } -} -$$::jsonb -) -*/ - DO $$ declare _t text;