From 9cf92563ae736850ab0d4f4ba00a130bb267c7e1 Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Thu, 16 Apr 2026 11:05:18 +0200 Subject: [PATCH] =?UTF-8?q?Int=C3=A9gration=20de=20src.db=20dans=20utils?= =?UTF-8?q?=20(coexistence=20avec=20les=20globaux)=20(#71)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils.py b/src/utils.py index 204c1d1..0a2c751 100644 --- a/src/utils.py +++ b/src/utils.py @@ -13,6 +13,9 @@ from httpx import HTTPError, get, post from polars.exceptions import ComputeError from unidecode import unidecode +from src.db import conn as duckdb_conn # noqa: F401 (exposed for convenience) +from src.db import get_cursor, query_marches, schema # noqa: F401 + logging.basicConfig( format="%(asctime)s %(levelname)-8s %(message)s", level=logging.INFO, @@ -889,7 +892,10 @@ def make_org_jsonld(org_id, org_type, org_name=None, type_org_id="SIRET") -> dic df: pl.DataFrame = get_decp_data() -schema = df.collect_schema() +# schema and columns now come from src.db; overwrite in case any local code +# still reads them directly from utils. +schema = schema # re-exported from src.db +columns = schema.names() df_acheteurs = get_org_data(df, "acheteur") df_titulaires = get_org_data(df, "titulaire")