From df6c42933afb78c7e1f96116aadabf3cfdee6894 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 10 Feb 2026 09:59:23 +0000 Subject: [PATCH] do the database write --- .../persistence/condition_postgres.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/condition/persistence/condition_postgres.py b/backend/condition/persistence/condition_postgres.py index 9428eec6..e83df540 100644 --- a/backend/condition/persistence/condition_postgres.py +++ b/backend/condition/persistence/condition_postgres.py @@ -32,17 +32,17 @@ class ConditionPostgres: with db_session() as session: logger.info("[ConditionPostgres] Successfully made connection to database") - # for start in range(0, total, batch_size): - # end = min(start + batch_size, total) - # batch = survey_models[start:end] + for start in range(0, total, batch_size): + end = min(start + batch_size, total) + batch = survey_models[start:end] - # t0: float = time.perf_counter() - # ConditionPostgres._insert_surveys_batch(batch, session) - # elapsed: float = time.perf_counter() - t0 + t0: float = time.perf_counter() + ConditionPostgres._insert_surveys_batch(batch, session) + elapsed: float = time.perf_counter() - t0 - # logger.info( - # f"Inserted batch {start} - {end} ({len(batch)} surveys) in {elapsed} seconds", - # ) + logger.info( + f"Inserted batch {start} - {end} ({len(batch)} surveys) in {elapsed} seconds", + ) @staticmethod def map_survey_to_model(