From 2448ccf64156470510980878086bb3ed02411cac Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 26 Oct 2017 13:39:50 -0400 Subject: [PATCH] add new map, add column for all json, and apply index --- ubm_data.sql | 1 + ubm_schema.sql | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ubm_data.sql b/ubm_data.sql index 6d6a56d..7e9f75d 100644 --- a/ubm_data.sql +++ b/ubm_data.sql @@ -44,6 +44,7 @@ INSERT INTO map_rm (srce, target, regex, seq) VALUES ('PNCC', 'Wires Out', '{"ma INSERT INTO map_rm (srce, target, regex, seq) VALUES ('PNCC', 'Currency', '{"map": "yes", "defn": [{"key": "{Description}", "field": "ini", "regex": "([\\w].*?)(?=$| -|\\s[0-9].*?|\\s[\\w/]+?:)", "retain": "y"}, {"key": "{Description}", "field": "curr1", "regex": ".*(DEBIT|CREDIT).*(USD|CAD).*(?=DEBIT|CREDIT).*(?=USD|CAD).*", "retain": "y"}, {"key": "{Description}", "field": "curr2", "regex": ".*(?=DEBIT|CREDIT).*(?=USD|CAD).*(DEBIT|CREDIT).*(USD|CAD).*", "retain": "y"}], "where": [{"Transaction": "Miscellaneous Credits"}, {"Transaction": "Miscellaneous Debits"}], "function": "extract"}', 2); INSERT INTO map_rm (srce, target, regex, seq) VALUES ('PNCC', 'Check Number', '{"map": "yes", "defn": [{"key": "{Description}", "field": "checkn", "regex": "[^0-9]*([0-9]*)\\s|$", "retain": "y"}], "where": [{"Transaction": "Checks Paid"}], "function": "extract"}', 2); INSERT INTO map_rm (srce, target, regex, seq) VALUES ('PNCC', 'Strip Amount Commas', '{"map": "no", "defn": [{"key": "{Amount}", "flag": "g", "field": "amount", "regex": ",", "retain": "y", "replace": ""}], "name": "Strip Amount Commas", "where": [{}], "function": "replace", "description": "the Amount field come from PNC with commas embeded so it cannot be cast to numeric"}', 1); +INSERT INTO map_rm (srce, target, regex, seq) VALUES ('PNCC', 'Parse Descr', '{"map": "no", "defn": [{"key": "{Description}", "flag": "g", "field": "dparse", "regex": "([A-Z]{3,}?:)(.*)(?=[A-Z]{3,}?:|$)", "retain": "y"}], "name": "Parse Descr", "where": [{}], "function": "extract", "description": "parse the description based on at least three capital letters followed by a comma until another set of at lesat 3 capital letters and a comma is encountered"}', 2); -- diff --git a/ubm_schema.sql b/ubm_schema.sql index fbb876a..3f19da5 100644 --- a/ubm_schema.sql +++ b/ubm_schema.sql @@ -274,7 +274,8 @@ CREATE TABLE trans ( srce text, rec jsonb, parse jsonb, - map jsonb + map jsonb, + allj jsonb ); @@ -368,6 +369,13 @@ ALTER TABLE ONLY trans ADD CONSTRAINT trans_pkey PRIMARY KEY (id); +-- +-- Name: trans_allj; Type: INDEX; Schema: tps; Owner: - +-- + +CREATE INDEX trans_allj ON trans USING gin (allj); + + -- -- Name: trans_rec; Type: INDEX; Schema: tps; Owner: - --