← back to Dw Yolo Loop
Kravet Jan-2026 price list -> dw_unified: kravet_master_price_2026 keyed master (8191 rows, joins live on mfr_sku, unlocks 457 ROLL wallcovering reprice targets)
d1813968c11c5e84db33cd6ccc20cc39485aac78 · 2026-06-16 13:47:04 -0700 · Steve Abrams
Files touched
A scripts/kravet-master-2026/build_csv.pyA scripts/kravet-master-2026/load.sh
Diff
commit d1813968c11c5e84db33cd6ccc20cc39485aac78
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Jun 16 13:47:04 2026 -0700
Kravet Jan-2026 price list -> dw_unified: kravet_master_price_2026 keyed master (8191 rows, joins live on mfr_sku, unlocks 457 ROLL wallcovering reprice targets)
---
scripts/kravet-master-2026/build_csv.py | 35 +++++++++++++++++++++++++++++
scripts/kravet-master-2026/load.sh | 40 +++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+)
diff --git a/scripts/kravet-master-2026/build_csv.py b/scripts/kravet-master-2026/build_csv.py
new file mode 100755
index 0000000..c07e96b
--- /dev/null
+++ b/scripts/kravet-master-2026/build_csv.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+"""Build /tmp/kravet_master_2026.csv from the GDrive 'Kravet Price list 1-20-26.xlsx'.
+Authoritative Jan-2026 Kravet-family MAP master (8,191 rows; NEW MAP = NEW WHLS x 1.5).
+Columns: Item | Brand | CURRENT WHLS | CURRENT MAP | Unit of measure | Collection |
+ Use | NEW Wholesale (Incl Tariff) | NEW MAP (Incl Tariff) | effective date | Tariff%.
+Rows can be ragged (short tuples) -> pad-guarded. Then run load.sh to push into dw_unified.
+Fetch the xlsx first: rclone copy 'gdrive:Kravet Price list 1-20-26.xlsx' /tmp/
+"""
+import openpyxl, csv, datetime, sys
+
+SRC = sys.argv[1] if len(sys.argv) > 1 else "/tmp/Kravet Price list 1-20-26.xlsx"
+OUT = sys.argv[2] if len(sys.argv) > 2 else "/tmp/kravet_master_2026.csv"
+
+wb = openpyxl.load_workbook(SRC, read_only=True, data_only=True)
+ws = wb["Sheet1"]
+rows = [r for r in ws.iter_rows(min_row=2, values_only=True) if r and r[0]]
+
+def g(r, i): return r[i] if i < len(r) else None
+def num(x):
+ try: return float(str(x).strip())
+ except Exception: return ""
+def dt(x):
+ if x is None: return ""
+ if isinstance(x, (datetime.datetime, datetime.date)): return x.strftime("%Y-%m-%d")
+ s = str(x).strip(); return s.split(" ")[0] if s else ""
+def s(x): return str(x).strip() if x is not None else ""
+
+with open(OUT, "w", newline="") as f:
+ w = csv.writer(f)
+ w.writerow(["item","brand","cur_whls","cur_map","uom","collection",
+ "use_category","new_whls","new_map","effective_date","tariff_pct"])
+ for r in rows:
+ w.writerow([s(g(r,0)), s(g(r,1)), num(g(r,2)), num(g(r,3)), s(g(r,4)).upper(),
+ s(g(r,5)), s(g(r,6)).upper(), num(g(r,7)), num(g(r,8)), dt(g(r,9)), num(g(r,10))])
+print(f"wrote {OUT} — {len(rows)} rows")
diff --git a/scripts/kravet-master-2026/load.sh b/scripts/kravet-master-2026/load.sh
new file mode 100755
index 0000000..a85c1b2
--- /dev/null
+++ b/scripts/kravet-master-2026/load.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+# Load the authoritative Jan-2026 Kravet price list into dw_unified (Kamatera canonical)
+# as kravet_master_price_2026, keyed by Item SKU. Additive reference table, re-runnable.
+# Source: GDrive "Kravet Price list 1-20-26.xlsx" (8,191 rows; NEW MAP = NEW WHLS x 1.5 verified).
+# Build the CSV first via build_csv.py, then run this. Read-only w.r.t. the storefront.
+set -euo pipefail
+CSV="${1:-/tmp/kravet_master_2026.csv}"
+REMOTE_CSV="/tmp/kravet_master_2026.csv"
+SSH="my-server"
+PSQL="psql -U dw_admin -d dw_unified -h 127.0.0.1"
+
+[ -f "$CSV" ] || { echo "missing $CSV — run build_csv.py first"; exit 1; }
+echo "scp $CSV -> $SSH:$REMOTE_CSV"
+scp -q "$CSV" "$SSH:$REMOTE_CSV"
+
+ssh "$SSH" "$PSQL -v ON_ERROR_STOP=1 <<'SQL'
+DROP TABLE IF EXISTS kravet_master_price_2026;
+CREATE TABLE kravet_master_price_2026 (
+ item text PRIMARY KEY,
+ brand text,
+ cur_whls numeric,
+ cur_map numeric,
+ uom text,
+ collection text,
+ use_category text,
+ new_whls numeric,
+ new_map numeric,
+ effective_date date,
+ tariff_pct numeric,
+ loaded_at timestamptz DEFAULT now(),
+ source_file text DEFAULT 'Kravet Price list 1-20-26.xlsx'
+);
+\copy kravet_master_price_2026 (item,brand,cur_whls,cur_map,uom,collection,use_category,new_whls,new_map,effective_date,tariff_pct) FROM '$REMOTE_CSV' WITH (FORMAT csv, HEADER true)
+CREATE INDEX idx_kmp26_item_upper ON kravet_master_price_2026 (upper(item));
+CREATE INDEX idx_kmp26_brand ON kravet_master_price_2026 (upper(brand));
+CREATE INDEX idx_kmp26_uom ON kravet_master_price_2026 (uom);
+ANALYZE kravet_master_price_2026;
+SQL"
+echo "== verify =="
+ssh "$SSH" "$PSQL -tA -F'|' -c \"select count(*) rows, count(distinct item) items, count(*) filter (where uom='ROLL') roll, count(*) filter (where new_map>0) has_newmap from kravet_master_price_2026;\""
← f72b052 sitemap emergence sizing (c35): philipperomano fully generat
·
back to Dw Yolo Loop
·
cycle-33: promote-canary.sh harness — generate launchd plist ff928c0 →