diff --git a/loan_bal.pgsql b/loan_bal.pgsql index a149817..ec55276 100644 --- a/loan_bal.pgsql +++ b/loan_bal.pgsql @@ -6,9 +6,9 @@ FROM tps.trans LEFT JOIN LATERAL jsonb_populate_record(null::tps.pnco, rec) r ON TRUE WHERE - rec @> '{"Loan#":"606780191"}' + rec @> '{"Loan#":"606780281"}' ORDER BY r."Loan#" - ,r."Post Date" asc - ,rec->>'id' asc - ,r."Reference #" asc + ,r."Post Date" ASC + ,rec->>'id' ASC + ,r."Reference #" ASC \ No newline at end of file diff --git a/map_rv_items_not_mapped.pgsql b/map_rv_items_not_mapped.pgsql new file mode 100644 index 0000000..e69de29 diff --git a/srce_template.pgsql b/srce_template.pgsql index c32ace4..c12c125 100644 --- a/srce_template.pgsql +++ b/srce_template.pgsql @@ -1,39 +1,128 @@ -insert into tps.srce -SELECT -'CAMZ', +UPDATE tps.SRCE + +SET DEFN = $$ { - "name": "CAMZ", - "description":"Chase Amazon Credit Card", - "type": "csv", + "name": "WMPD", + "descr": "Williams Paid File", + "type":"csv", "schema": [ { - "key": "Type", + "key": "Carrier", "type": "text" }, { - "key": "Trans Date", - "type": "date" - }, - { - "key": "Post Date", - "type": "date" - }, - { - "key": "Description", + "key": "SCAC", "type": "text" }, { - "key": "Amount", + "key": "Mode", + "type": "text" + }, + { + "key": "Pro #", + "type": "text" + }, + { + "key": "B/L", + "type": "text" + }, + { + "key": "Pd Amt", "type": "numeric" + }, + { + "key": "Loc#", + "type": "text" + }, + { + "key": "Pcs", + "type": "numeric" + }, + { + "key": "Wgt", + "type": "numeric" + }, + { + "key": "Chk#", + "type": "numeric" + }, + { + "key": "Pay Dt", + "type": "date" + }, + { + "key": "Acct #", + "type": "text" + }, + { + "key": "I/O", + "type": "text" + }, + { + "key": "Sh Nm", + "type": "text" + }, + { + "key": "Sh City", + "type": "text" + }, + { + "key": "Sh St", + "type": "text" + }, + { + "key": "Sh Zip", + "type": "text" + }, + { + "key": "Cons Nm", + "type": "text" + }, + { + "key": "D City ", + "type": "text" + }, + { + "key": "D St", + "type": "text" + }, + { + "key": "D Zip", + "type": "text" + }, + { + "key": "Sh Dt", + "type": "date" + }, + { + "key": "Inv Dt", + "type": "date" + }, + { + "key": "Customs Entry#", + "type": "text" + }, + { + "key": "Miles", + "type": "numeric" + }, + { + "key": "Frt Class", + "type": "text" + }, + { + "key": "Master B/L", + "type": "text" } ], "unique_constraint": { - "type": "key", - "fields": [ - "{Trans Date}" - ,"{Post Date}" + "fields":[ + "{Pay Dt}", + "{Carrier}" ] } } -$$::JSONB \ No newline at end of file +$$::JSONB +WHERE +SRCE = 'WMPD' \ No newline at end of file diff --git a/transaction_range.pgsql b/transaction_range.pgsql index c55a083..75c98b9 100644 --- a/transaction_range.pgsql +++ b/transaction_range.pgsql @@ -1,3 +1,4 @@ +\timing SELECT t.srce ,(ae.e::text[])[1] unq_constr