Skip to content

Commit

Permalink
Report number of rows inserted in BaseCarton
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Dec 14, 2024
1 parent 46357c8 commit 661cfc6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions python/target_selection/cartons/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -1316,7 +1316,7 @@ def split_cadence(cadence):
)

# Now do the insert
(
cursor = (
CartonToTarget.insert_from(
select_from,
[
Expand All @@ -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``."""
Expand Down

0 comments on commit 661cfc6

Please sign in to comment.