feat: removed dimensions from schema
parent
6d7f4909cc
commit
1bc5daa29e
|
@ -20,9 +20,6 @@ class CleanRow(TypedDict):
|
||||||
materials: Optional[List[str]]
|
materials: Optional[List[str]]
|
||||||
packaging: int
|
packaging: int
|
||||||
origin: str
|
origin: str
|
||||||
height: Optional[float]
|
|
||||||
depth: Optional[float]
|
|
||||||
width: Optional[float]
|
|
||||||
weight: 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"))
|
origin = clean_origin_name(specifications.get("origin"))
|
||||||
|
|
||||||
|
weight = parse_weight(specifications.get("weight"))
|
||||||
|
if weight is None:
|
||||||
dimensions = parse_dimensions(specifications.get("dimensions"))
|
dimensions = parse_dimensions(specifications.get("dimensions"))
|
||||||
height = dimensions["height"]
|
height = dimensions["height"]
|
||||||
width = dimensions["width"]
|
width = dimensions["width"]
|
||||||
depth = dimensions["depth"]
|
depth = dimensions["depth"]
|
||||||
|
weight = dimensional_weight(height=height, width=width, depth=depth)
|
||||||
weight = parse_weight(specifications.get("weight"))
|
|
||||||
if weight is None:
|
|
||||||
weight = dimensional_weight(height=height, width=weight, depth=depth)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"gtin13": gtin13,
|
"gtin13": gtin13,
|
||||||
|
@ -85,8 +81,5 @@ def parse_row(element: Dict[str, str]) -> Optional[CleanRow]:
|
||||||
"materials": materials,
|
"materials": materials,
|
||||||
"packaging": packaging,
|
"packaging": packaging,
|
||||||
"origin": origin,
|
"origin": origin,
|
||||||
"height": height,
|
|
||||||
"width": width,
|
|
||||||
"depth": depth,
|
|
||||||
"weight": weight,
|
"weight": weight,
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,5 @@ CREATE TABLE IF NOT EXISTS {{ params.products_table }} (
|
||||||
materials VARCHAR[],
|
materials VARCHAR[],
|
||||||
packaging INT NOT NULL,
|
packaging INT NOT NULL,
|
||||||
origin VARCHAR NOT NULL,
|
origin VARCHAR NOT NULL,
|
||||||
height NUMERIC,
|
|
||||||
width NUMERIC,
|
|
||||||
depth NUMERIC,
|
|
||||||
weight NUMERIC
|
weight NUMERIC
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue