From e03bae049e81be49619c775aa13faf0a9b1d364b Mon Sep 17 00:00:00 2001 From: Jakob van Santen Date: Mon, 12 Feb 2024 20:13:16 +0100 Subject: [PATCH] Fill count field on archive insert --- ampel/ztf/t0/ArchiveUpdater.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ampel/ztf/t0/ArchiveUpdater.py b/ampel/ztf/t0/ArchiveUpdater.py index 07cca52..5db6744 100755 --- a/ampel/ztf/t0/ArchiveUpdater.py +++ b/ampel/ztf/t0/ArchiveUpdater.py @@ -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] @@ -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