From f0b0e04bb6aa1744c802d4eb5cd1cb7c84c88b02 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 2 Jun 2025 12:25:58 -0500 Subject: Add some debugging statements. --- uploader/phenotypes/models.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'uploader') diff --git a/uploader/phenotypes/models.py b/uploader/phenotypes/models.py index eb926d8..f4d3529 100644 --- a/uploader/phenotypes/models.py +++ b/uploader/phenotypes/models.py @@ -336,12 +336,14 @@ def save_phenotypes_data( }[table] saved_data = tuple() with conn.cursor(cursorclass=DictCursor) as cursor: + _count = 0 while True: batch = take(data, 5000): if len(batch) == 0: logger.warning("Got an empty batch. This needs investigation.") break + logger.debug("Saving batch of %s items.", len(batch)) cursor.executemany( (f"INSERT INTO {_table_details['table']}" f"({_table_details['DataIdCol']}, StrainId, {_table_details['valueCol']}) " @@ -359,5 +361,8 @@ def save_phenotypes_data( for item in batch) for single in items)) saved_data = saved_data + tuple(dict(row) for row in cursor.fetchall()) + _count = _count + len(batch) + + logger.debug("Saved a total of %s data rows", _count) return saved_data -- cgit v1.2.3