explore options on format

This commit is contained in:
Paul Trowbridge 2017-09-19 07:17:38 -04:00
parent f240e95e2d
commit 76dca0d688
3 changed files with 11 additions and 0 deletions

Binary file not shown.

6
event_log.md Normal file
View File

@ -0,0 +1,6 @@
event log
collection of dissimilar items
-> trigger based on insert adds to GL
-> gl adds to balance based on GL trigger
? how is fiscal period determined

5
new_format.pgsql Normal file
View File

@ -0,0 +1,5 @@
WITH j AS (
SELECT
JSONB_PRETTY($${"vendor":"Drug Mart","date":"2017-08-20","instrument":"Discover Card","module":"MJE_O","offset":"dcard","total":18.25,"item":[{"item":"Green Chili","amount":1.49,"reason":"food"},{"item":"Black Beans","amount":1.6,"reason":"food"},{"item":"Distilled Water","amount":7.12,"reason":"food"},{"item":"Fruit Preservative","amount":3.99,"reason":"food"},{"item":"Watch Battery","amount":3.79,"reason":"supplies"},{"item":"Sales Tax","amount":"0.26","reason":"taxes"}],"gl":[{"gl":"food","amount":1.49,"reason":"food","item":"Green Chili"},{"gl":"food","amount":1.6,"reason":"food","item":"Black Beans"},{"gl":"food","amount":7.12,"reason":"food","item":"Distilled Water"},{"gl":"food","amount":3.99,"reason":"food","item":"Fruit Preservative"},{"gl":"supplies","amount":3.79,"reason":"supplies","item":"Watch Battery"},{"gl":"taxes","amount":"0.26","reason":"taxes","item":"Sales Tax"},{"gl":"dcard","amount":-1.49,"reason":"food","item":"Green Chili"},{"gl":"dcard","amount":-1.6,"reason":"food","item":"Black Beans"},{"gl":"dcard","amount":-7.12,"reason":"food","item":"Distilled Water"},{"gl":"dcard","amount":-3.99,"reason":"food","item":"Fruit Preservative"},{"gl":"dcard","amount":-3.79,"reason":"supplies","item":"Watch Battery"},{"gl":"dcard","amount":-0.26,"reason":"taxes","item":"Sales Tax"}]}$$::JSONB) as r
)
select j.r->'vendor' from j