comdirect ingest: overhaul

This commit is contained in:
2026-09-12 10:13:59 +02:00
parent 69c13f93ac
commit c354523ae9
7 changed files with 125 additions and 74 deletions
+5 -5
View File
@@ -7,6 +7,11 @@ from src.ingest._common import _reader_raw, _upsert
from src.models.b4w import B4wDb, B4wExport, Category, CategoryDb
def reader_b4w(path: Path) -> list[B4wExport]:
raw = _reader_raw(path)
return list(map(B4wExport.model_validate, raw))
def upsert_category(
session: Session, category: Category | None, do_commit=True
) -> CategoryDb | None:
@@ -65,8 +70,3 @@ def ingest_b4w(path: Path):
for row in data:
upsert_b4w(session, row, do_commit=False)
session.commit()
def reader_b4w(path: Path) -> list[B4wExport]:
raw = _reader_raw(path)
return list(map(B4wExport.model_validate, raw))