mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
log db session but dont write to db
This commit is contained in:
parent
cd0ae37d40
commit
b026a7ae9e
2 changed files with 12 additions and 11 deletions
|
|
@ -31,17 +31,18 @@ class ConditionPostgres:
|
||||||
)
|
)
|
||||||
|
|
||||||
with db_session() as session:
|
with db_session() as session:
|
||||||
for start in range(0, total, batch_size):
|
logger.info("Successfully made connection to database:", session)
|
||||||
end = min(start + batch_size, total)
|
# for start in range(0, total, batch_size):
|
||||||
batch = survey_models[start:end]
|
# end = min(start + batch_size, total)
|
||||||
|
# batch = survey_models[start:end]
|
||||||
|
|
||||||
t0: float = time.perf_counter()
|
# t0: float = time.perf_counter()
|
||||||
ConditionPostgres._insert_surveys_batch(batch, session)
|
# ConditionPostgres._insert_surveys_batch(batch, session)
|
||||||
elapsed: float = time.perf_counter() - t0
|
# elapsed: float = time.perf_counter() - t0
|
||||||
|
|
||||||
logger.info(
|
# logger.info(
|
||||||
f"Inserted batch {start} - {end} ({len(batch)} surveys) in {elapsed} seconds",
|
# f"Inserted batch {start} - {end} ({len(batch)} surveys) in {elapsed} seconds",
|
||||||
)
|
# )
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def map_survey_to_model(
|
def map_survey_to_model(
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,6 @@ def process_file(
|
||||||
f"[processor] Finished mapping {len(property_condition_surveys)} properties. Writing to database..."
|
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")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue