feat: removed dimensions from schema
parent
6d7f4909cc
commit
1bc5daa29e
|
@ -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"))
|
||||
|
||||
weight = parse_weight(specifications.get("weight"))
|
||||
if weight is None:
|
||||
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)
|
||||
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,
|
||||
}
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue