diff options
Diffstat (limited to 'uploader/phenotypes/models.py')
-rw-r--r-- | uploader/phenotypes/models.py | 5 |
1 files changed, 5 insertions, 0 deletions
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 |