Skip to content

Commit

Permalink
Fill count field on archive insert
Browse files Browse the repository at this point in the history
  • Loading branch information
jvansanten committed Feb 12, 2024
1 parent 10b9425 commit e03bae0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ampel/ztf/t0/ArchiveUpdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def insert_alert_chunk(
else:
archive_id = conn.execute(
AvroArchive.insert()
.values(uri=archive_uri)
.values(uri=archive_uri, count=len(alerts))
.returning(AvroArchive.c.avro_archive_id)
).fetchone()[0]

Expand Down Expand Up @@ -165,6 +165,9 @@ def _insert_alert(self, conn, alert, partition_id=0, ingestion_time=0):
):
if len(rows) > 0:
self._update_history(conn, label, rows, alert_id)

if forced_photometry := alert.get("fp_hists", []):
self._update_history(conn, "fp_hist", forced_photometry, alert_id)

return True

Expand Down

0 comments on commit e03bae0

Please sign in to comment.