comdirect ingest: overhaul
This commit is contained in:
+5
-5
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user