start working on integrating logging

This commit is contained in:
Paul Trowbridge 2020-12-08 01:30:02 -05:00
parent 40ccaefbc8
commit 028bda6c26
3 changed files with 20 additions and 4 deletions

View File

@ -51,5 +51,6 @@ running problem list
- [ ] there is not currently any initial grouping to limit excess data from all the document# scenarios - [ ] there is not currently any initial grouping to limit excess data from all the document# scenarios
* general * general
- [ ] clean up SQL generation to prevent injection - [ ] clean up SQL generation to prevent injection
- [ ] **the sales data has to have a column for module and change ID, live sales data isn't going to work well**
- [ ] how to handle a target value adjustment, which currency is it in? - [ ] how to handle a target value adjustment, which currency is it in?
- [ ] **the sales data has to have a column for module and change ID, live sales data isn't going to work well**
- [ ] need to target the live sales data, build build a whole new table to use it plus add version columns

View File

@ -111,6 +111,14 @@ vscale AS (
FROM FROM
basemix basemix
) )
,ilog AS (
INSERT INTO
fc.log (doc)
SELECT
req.j
FROM
req
)
,volume AS ( ,volume AS (
SELECT SELECT
$$||_clist_vol||$$ $$||_clist_vol||$$

View File

@ -1,7 +1,7 @@
--assumes schema fc already exists --assumes schema fc already exists
DROP TABLE IF EXISTS fc.target_meta; --DROP TABLE IF EXISTS fc.target_meta;
CREATE TABLE fc.target_meta ( CREATE TABLE IF NOT EXISTS fc.target_meta (
tname text tname text
,cname text ,cname text
,opos int ,opos int
@ -15,7 +15,7 @@ CREATE TABLE fc.target_meta (
); );
--ALTER TABLE fc.target_meta DROP CONSTRAINT IF EXISTS target_meta_pk; --ALTER TABLE fc.target_meta DROP CONSTRAINT IF EXISTS target_meta_pk;
ALTER TABLE fc.target_meta ADD CONSTRAINT target_meta_pk PRIMARY KEY (tname, cname); ALTER TABLE fc.target_meta ADD CONSTRAINT IF NOT EXISTS target_meta_pk PRIMARY KEY (tname, cname);
COMMENT ON TABLE fc.target_meta IS 'target table layout info'; COMMENT ON TABLE fc.target_meta IS 'target table layout info';
COMMENT ON COLUMN fc.target_meta.tname IS 'schema.table_name of target sales data table'; COMMENT ON COLUMN fc.target_meta.tname IS 'schema.table_name of target sales data table';
@ -28,3 +28,10 @@ COMMENT ON COLUMN fc.target_meta.dtype IS 'data type of the sales table column';
COMMENT ON COLUMN fc.target_meta.mastcol IS 'associated field from the master data table if it is different (oseas would refer to ssyr in fc.perd)'; COMMENT ON COLUMN fc.target_meta.mastcol IS 'associated field from the master data table if it is different (oseas would refer to ssyr in fc.perd)';
COMMENT ON COLUMN fc.target_meta.appcol IS 'supply column name to be used for application variables - (specifcy the order date column)'; COMMENT ON COLUMN fc.target_meta.appcol IS 'supply column name to be used for application variables - (specifcy the order date column)';
COMMENT ON COLUMN fc.target_meta.dateref IS 'reference to the relevant hard coded perd table column for dates'; COMMENT ON COLUMN fc.target_meta.dateref IS 'reference to the relevant hard coded perd table column for dates';
CREATE TABLE IF NOT EXISTS fc.log (
id int GENERATED ALWAYS AS IDENTITY
,doc jsonb
);
COMMENT ON TABLE fc.log IS 'forecast change log';