log db session but dont write to db

This commit is contained in:
Daniel Roth 2026-02-10 09:02:44 +00:00
parent cd0ae37d40
commit b026a7ae9e
2 changed files with 12 additions and 11 deletions

View file

@ -31,17 +31,18 @@ class ConditionPostgres:
)
with db_session() as session:
for start in range(0, total, batch_size):
end = min(start + batch_size, total)
batch = survey_models[start:end]
logger.info("Successfully made connection to database:", session)
# 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(

View file

@ -43,6 +43,6 @@ def process_file(
f"[processor] Finished mapping {len(property_condition_surveys)} properties. Writing to database..."
)
# persistence.bulk_insert_surveys(property_condition_surveys)
persistence.bulk_insert_surveys(property_condition_surveys)
# logger.info(f"[processor] Finished loading surveys to database")
logger.info(f"[processor] Finished loading surveys to database")