add query to give items that have no map but are supposed to be mapped

This commit is contained in:
Paul Trowbridge 2017-11-02 15:07:47 -04:00
parent 242ebb8029
commit 53bc59a4cb
4 changed files with 116 additions and 26 deletions

View File

@ -6,9 +6,9 @@ FROM
tps.trans tps.trans
LEFT JOIN LATERAL jsonb_populate_record(null::tps.pnco, rec) r ON TRUE LEFT JOIN LATERAL jsonb_populate_record(null::tps.pnco, rec) r ON TRUE
WHERE WHERE
rec @> '{"Loan#":"606780191"}' rec @> '{"Loan#":"606780281"}'
ORDER BY ORDER BY
r."Loan#" r."Loan#"
,r."Post Date" asc ,r."Post Date" ASC
,rec->>'id' asc ,rec->>'id' ASC
,r."Reference #" asc ,r."Reference #" ASC

View File

View File

@ -1,39 +1,128 @@
insert into tps.srce UPDATE tps.SRCE
SELECT
'CAMZ', SET DEFN =
$$ $$
{ {
"name": "CAMZ", "name": "WMPD",
"description":"Chase Amazon Credit Card", "descr": "Williams Paid File",
"type": "csv", "type":"csv",
"schema": [ "schema": [
{ {
"key": "Type", "key": "Carrier",
"type": "text" "type": "text"
}, },
{ {
"key": "Trans Date", "key": "SCAC",
"type": "date"
},
{
"key": "Post Date",
"type": "date"
},
{
"key": "Description",
"type": "text" "type": "text"
}, },
{ {
"key": "Amount", "key": "Mode",
"type": "text"
},
{
"key": "Pro #",
"type": "text"
},
{
"key": "B/L",
"type": "text"
},
{
"key": "Pd Amt",
"type": "numeric" "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": { "unique_constraint": {
"type": "key", "fields":[
"fields": [ "{Pay Dt}",
"{Trans Date}" "{Carrier}"
,"{Post Date}"
] ]
} }
} }
$$::JSONB $$::JSONB
WHERE
SRCE = 'WMPD'

View File

@ -1,3 +1,4 @@
\timing
SELECT SELECT
t.srce t.srce
,(ae.e::text[])[1] unq_constr ,(ae.e::text[])[1] unq_constr