vault backup: 2023-10-18 08:37:38

This commit is contained in:
Paul Trowbridge 2023-10-18 08:37:38 -04:00
parent 4baa1c7382
commit 10e3a2cb8a
3 changed files with 24 additions and 7 deletions

15
sql/get.sql Normal file
View File

@ -0,0 +1,15 @@
SELECT
gset
,agglevel
,e.k
,e.v->>'units'
,e.v->>'price_usd'
,e.v->>'target_price'
FROM
rlarp.price_pool_dev
JOIN LATERAL JSONB_EACH(season) e(k,v) ON TRUE
WHERE
gset @> '{"baseitem":"XNS0T1G3"}'::jsonb
ORDER BY
agglevel ASC
;

View File

@ -75,13 +75,13 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
SELECT SELECT
jsonb_strip_nulls( jsonb_strip_nulls(
jsonb_build_object( jsonb_build_object(
'customer' ,CASE WHEN GROUPING(customer ) = 0 THEN customer END 'cust' ,customer
,'chanwide' ,CASE WHEN GROUPING(chanwide ) = 0 THEN chanwide END ,'chan' ,chanwide
,'nursery_region' ,CASE WHEN GROUPING(nursery_region ) = 0 THEN nursery_region END ,'nurs' ,nursery_region
,'greenhouse_region' ,CASE WHEN GROUPING(greenhouse_region ) = 0 THEN greenhouse_region END ,'ghse' ,greenhouse_region
,'baseitem' ,CASE WHEN GROUPING(baseitem ) = 0 THEN baseitem END ,'mold' ,baseitem
,'v1dataseg' ,CASE WHEN GROUPING(v1dataseg ) = 0 THEN v1dataseg END ,'v1ds' ,v1dataseg
,'v0dataseg' ,CASE WHEN GROUPING(v0dataseg ) = 0 THEN v0dataseg END ,'v0ds' ,v0dataseg
) )
) gset ) gset
,oseas ,oseas

View File

@ -1,2 +1,4 @@
- [ ] label aggregation levels with a sort and a short label - [ ] label aggregation levels with a sort and a short label
- [ ] unwrap the data to the necessary level to get back to a table - [ ] unwrap the data to the necessary level to get back to a table
- [ ] what if you want history on an exact SKU to see volume purchases etc?
- maybe just go straight to the data in that case and leave price pool to be the aggregate data