From 1bc5daa29e1a584857d2b636ac09b334f73cd037 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Sun, 25 Jun 2023 13:19:51 +0200 Subject: [PATCH] feat: removed dimensions from schema --- etl/helpers/parse_row.py | 17 +++++------------ sql/products_schema.sql | 3 --- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/etl/helpers/parse_row.py b/etl/helpers/parse_row.py index fb2d711..2c8c8ce 100644 --- a/etl/helpers/parse_row.py +++ b/etl/helpers/parse_row.py @@ -20,9 +20,6 @@ class CleanRow(TypedDict): materials: Optional[List[str]] packaging: int origin: str - height: Optional[float] - depth: Optional[float] - width: Optional[float] weight: Optional[float] @@ -69,14 +66,13 @@ def parse_row(element: Dict[str, str]) -> Optional[CleanRow]: origin = clean_origin_name(specifications.get("origin")) - dimensions = parse_dimensions(specifications.get("dimensions")) - height = dimensions["height"] - width = dimensions["width"] - depth = dimensions["depth"] - weight = parse_weight(specifications.get("weight")) if weight is None: - weight = dimensional_weight(height=height, width=weight, depth=depth) + dimensions = parse_dimensions(specifications.get("dimensions")) + height = dimensions["height"] + width = dimensions["width"] + depth = dimensions["depth"] + weight = dimensional_weight(height=height, width=width, depth=depth) return { "gtin13": gtin13, @@ -85,8 +81,5 @@ def parse_row(element: Dict[str, str]) -> Optional[CleanRow]: "materials": materials, "packaging": packaging, "origin": origin, - "height": height, - "width": width, - "depth": depth, "weight": weight, } diff --git a/sql/products_schema.sql b/sql/products_schema.sql index 76736b8..23508f4 100644 --- a/sql/products_schema.sql +++ b/sql/products_schema.sql @@ -5,8 +5,5 @@ CREATE TABLE IF NOT EXISTS {{ params.products_table }} ( materials VARCHAR[], packaging INT NOT NULL, origin VARCHAR NOT NULL, - height NUMERIC, - width NUMERIC, - depth NUMERIC, weight NUMERIC );