From 661cfc607567d2282f21dd53efb9ef1510292d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Sat, 14 Dec 2024 10:50:47 -0800 Subject: [PATCH] Report number of rows inserted in BaseCarton --- python/target_selection/cartons/base.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/target_selection/cartons/base.py b/python/target_selection/cartons/base.py index 1f3181a6..eb47cfdc 100644 --- a/python/target_selection/cartons/base.py +++ b/python/target_selection/cartons/base.py @@ -1014,7 +1014,7 @@ def _load_targets(self, RModel): self.log.debug("loading data into targetdb.target.") - ( + cursor = ( tdb.Target.insert_from( cdb.Catalog.select( cdb.Catalog.catalogid, @@ -1048,7 +1048,7 @@ def _load_targets(self, RModel): .execute() ) - self.log.info("Inserted new rows into targetdb.target.") + self.log.info(f"Inserted {cursor.rowcount} new rows into targetdb.target.") return @@ -1131,9 +1131,9 @@ def _load_magnitudes(self, RModel): select_from = select_from.select_extend(RModel._meta.columns["optical_prov"]) fields.append(Magnitude.optical_prov) - Magnitude.insert_from(select_from, fields).returning().execute() + cursor = Magnitude.insert_from(select_from, fields).returning().execute() - self.log.info("Inserted new rows into targetdb.magnitude.") + self.log.info(f"Inserted {cursor.rowcount} new rows into targetdb.magnitude.") def _load_carton_to_target(self, RModel): """Populate targetdb.carton_to_target.""" @@ -1316,7 +1316,7 @@ def split_cadence(cadence): ) # Now do the insert - ( + cursor = ( CartonToTarget.insert_from( select_from, [ @@ -1337,7 +1337,7 @@ def split_cadence(cadence): .execute() ) - self.log.info("Inserted rows into targetdb.carton_to_target.") + self.log.info(f"Inserted {cursor.rowcount} rows into targetdb.carton_to_target.") def drop_carton(self): """Drops the entry in ``targetdb.carton``."""