diff --git a/src/too/database.py b/src/too/database.py index 34d9456..405abd6 100644 --- a/src/too/database.py +++ b/src/too/database.py @@ -117,6 +117,9 @@ def load_too_targets( bright_limit_checks=validate_magnitude_limits, ) + # We always want to set the optical_prov column to too. + targets = targets.with_columns(optical_prov=polars.lit("too")) + too_columns = ["too_id"] too_columns += [col for col in too_dtypes if col not in too_metadata_columns] diff --git a/tests/test_database.py b/tests/test_database.py index 5d030b7..b8f6717 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -103,6 +103,12 @@ def test_load_too_targets(too_mock: polars.DataFrame, caplog: pytest.LogCaptureF assert added.height == 10 assert catalogdb.ToO_Target.select().count() == 10 + assert ( + catalogdb.ToO_Metadata.select() + .where(catalogdb.ToO_Metadata.optical_prov == "too") + .count() + == 10 + ) # Repeat. No new targets should be added. added = load_too_targets(too_mock[0:10], catalogdb.database)