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
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

View File

View File

@ -1,39 +1,128 @@
insert into tps.srce
SELECT
'CAMZ',
UPDATE tps.SRCE
SET DEFN =
$$
{
"name": "CAMZ",
"description":"Chase Amazon Credit Card",
"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}"
"{Pay Dt}",
"{Carrier}"
]
}
}
$$::JSONB
WHERE
SRCE = 'WMPD'

View File

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