Compare commits

...

2 Commits

Author SHA1 Message Date
4baa1c7382 vault backup: 2023-10-18 07:50:10 2023-10-18 07:50:10 -04:00
ea4d8213d4 vault backup: 2023-10-18 07:49:23 2023-10-18 07:49:23 -04:00
2 changed files with 22 additions and 19 deletions

View File

@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
o.customer
,o.chanwide
,o.nursery_region
,o.general_region
,c.greenhouse_region
,m.part_group baseitem
,m.majg
,m.assc
@ -46,6 +46,8 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
AND tq.mold = i.stlc
AND tq.chan = 'DISTRIB DROP SHIP'
AND tq.data_segment = _ds.dataseg
LEFT OUTER JOIN rlarp.cust c ON
c.code = CASE o.chan WHEN 'DIR' THEN o.bill_cust ELSE o.ship_cust END
WHERE
o.version <> '6/1 Order Book'
--AND o.part like 'SQL035%'
@ -57,7 +59,7 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
o.customer
,o.chanwide
,o.nursery_region
,o.general_region
,c.greenhouse_region
,m.part_group
,m.majg
,m.assc
@ -76,11 +78,10 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
'customer' ,CASE WHEN GROUPING(customer ) = 0 THEN customer END
,'chanwide' ,CASE WHEN GROUPING(chanwide ) = 0 THEN chanwide END
,'nursery_region' ,CASE WHEN GROUPING(nursery_region ) = 0 THEN nursery_region END
,'general_region' ,CASE WHEN GROUPING(general_region ) = 0 THEN general_region END
--,'country' ,CASE WHEN GROUPING(country) = 0 THEN country END
,'greenhouse_region' ,CASE WHEN GROUPING(greenhouse_region ) = 0 THEN greenhouse_region END
,'baseitem' ,CASE WHEN GROUPING(baseitem ) = 0 THEN baseitem END
,'v1dataseg' ,CASE WHEN GROUPING(v1dataseg) = 0 THEN v1dataseg END
,'v0dataseg' ,CASE WHEN GROUPING(v0dataseg) = 0 THEN v0dataseg END
,'v1dataseg' ,CASE WHEN GROUPING(v1dataseg ) = 0 THEN v1dataseg END
,'v0dataseg' ,CASE WHEN GROUPING(v0dataseg ) = 0 THEN v0dataseg END
)
) gset
,oseas
@ -93,14 +94,14 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
agg
GROUP BY GROUPING SETS (
-- oseas baseitem v0datseg chanwide customer region v1dataseg --
(oseas, baseitem, v0dataseg, customer )
,(oseas, baseitem, customer, v1dataseg )
,(oseas, baseitem, v0dataseg, chanwide )
,(oseas, baseitem, v0dataseg, chanwide, nursery_region )
,(oseas, baseitem, v0dataseg, chanwide, general_region )
(oseas, baseitem, chanwide, v0dataseg, customer )
,(oseas, baseitem, chanwide, customer, v1dataseg )
,(oseas, baseitem, chanwide, v0dataseg )
,(oseas, baseitem, chanwide, v0dataseg, nursery_region )
,(oseas, baseitem, chanwide, v0dataseg, greenhouse_region )
,(oseas, baseitem, chanwide, v1dataseg )
,(oseas, baseitem, v0dataseg, nursery_region )
,(oseas, baseitem, v0dataseg, general_region )
,(oseas, baseitem, chanwide, v0dataseg, nursery_region )
,(oseas, baseitem, chanwide, v0dataseg, greenhouse_region )
)
)
SELECT
@ -129,7 +130,7 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
-- rlarp.price_pool g
--WHERE
-- o.version IN ('Actual','Quotes')
-- AND g.gset = jsonb_build_object('baseitem',o.baseitem,'v0dataseg',o.v0dataseg,'chanwide','D','general_region','US');
-- AND g.gset = jsonb_build_object('baseitem',o.baseitem,'v0dataseg',o.v0dataseg,'chanwide','D','greenhouse_region','US');
--
--UPDATE
-- rlarp.osm_stack o

2
todo.md Normal file
View File

@ -0,0 +1,2 @@
- [ ] label aggregation levels with a sort and a short label
- [ ] unwrap the data to the necessary level to get back to a table