feat: removed dimensions from schema

main
Ricard Illa 2023-06-25 13:19:51 +02:00
parent 6d7f4909cc
commit 1bc5daa29e
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
2 changed files with 5 additions and 15 deletions

View File

@ -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,
}

View File

@ -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
);