Skip to content

Conversation

@mjuric
Copy link
Member

@mjuric mjuric commented Nov 22, 2025

Checklist

When making changes to YAML files in the schemas directory:

@mjuric mjuric marked this pull request as draft November 22, 2025 01:26
@mjuric mjuric force-pushed the tickets/DM-53310 branch 4 times, most recently from 617363b to 0fee2c2 Compare November 23, 2025 01:55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rearrange your changes so that diff shows actual differences in SSObject/SSSource tables? With current arrangement it's hard to guess which columns were added or dropped.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that the part of the change is the reordering of the fields themselves, so they show up in a logical order.

If it helps, sdm-schemas.lsst.io sorts alphabetically so maybe that's a way to compare for differences (here's before and after)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing web pages by eye is hard. We have felis diff, but it is not super user-friendly. @JeremyMcCormick, could we extend felis diff to produce a human-readable summary that ignores table and column re-ordering?

@JeremyMcCormick
Copy link
Collaborator

JeremyMcCormick commented Nov 24, 2025

@mjuric

There should be no need to prepend commit messages with the name of the schema like lsstcam.yaml: as the files affected are available in the log. We haven't generally done this in the repo.

Also, I think before merging this can be rebased down to a single commit or maybe just a few.

Finally, commit messages should start with an implicit verb like "Fix," "Change," etc.

:)

@JeremyMcCormick
Copy link
Collaborator

This check failure can be ignored:

https://github.com/lsst/sdm_schemas/actions/runs/19615135537/job/56166612401?pr=424

The tool is erroneously identifying one of your columns as a "band column."

The band column checker should have a switch for ignoring specific columns - I will make a ticket for this.

@mjuric
Copy link
Member Author

mjuric commented Nov 24, 2025

@mjuric

There should be no need to prepend commit messages with the name of the schema like lsstcam.yaml: as the files affected are available in the log. We haven't generally done this in the repo.

Also, I think before merging this can be rebased down to a single commit or maybe just a few.

Finally, commit messages should start with an implicit verb like "Fix," "Change," etc.

:)

All makes sense -- will do!

Right now what you're seeing is a lot of development in progress (may be good to ignore it); I'll squash/rebase at the end into a sensible set of commits.

@mjuric mjuric force-pushed the tickets/DM-53310 branch 4 times, most recently from e8a0a5d to a41fdc8 Compare November 25, 2025 16:24
@mjuric mjuric marked this pull request as ready for review November 25, 2025 16:28
@mjuric
Copy link
Member Author

mjuric commented Nov 25, 2025

Cleaned up the commits down to three logically distinct ones (though the PR is still showing the entire messy history), rebased to latest main, ready for review & merge.

@JeremyMcCormick
Copy link
Collaborator

Minor suggestion: changelog update commit can instead be "Add news fragment".

@JeremyMcCormick
Copy link
Collaborator

JeremyMcCormick commented Nov 25, 2025

@andy-slac The ids in apdb.yaml are removed in this PR. If
accepted, the dax_apdb code will need to pass "id_generation": True context to validate the schema now when loading the model. You can do that with model_validate or (preferably) Schema.from_uri. This will make Felis generate the ids automatically when loading in the schema.

You may want to do that immediately before this is even merged as merging this first could result in a broken weekly release. It is harmless to turn that on if the ids are already there as only missing ones are generated.

Copy link
Contributor

@andy-slac andy-slac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only looked at apdb.yaml, it looks OK with few questions/comment. As this patch does not really touch anything in APDB tables, we do not need to change version number.

name: "ApdbSchema"
"@id": "#apdbSchema"
version: "9.1.0"
version: "10.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we need a new version number, APDB database does not care about Solar System tables, and recent dax_apdb update dropped the only table that existed in APDB. We do not want to force people into doing unnecessary schema upgrades. Once we have sso.yaml we may want to track version changes in that schema, but that depends also on the clients of that schema.

Comment on lines 1615 to 1619
# FIXME: commented out as it generates a
# > raise ValueError(f"Dependency cycle in foreign keys: {tables}")
# exception. Unclear why, but as these aren't used in APDB yet there should be no harm. See:
# https://rubin-obs.slack.com/archives/C07QJMPRMLJ/p1763919304828269?thread_ts=1763826894.543509&cid=C07QJMPRMLJ
# for some discussion.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can uncomment this already, latest dax_apdb should be fixed.

Comment on lines 1630 to 1633
- name: idx_SSObject_ssObjectId
description: Unique index on the ssObjectId column
columns:
- "#SSObject.ssObjectId"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ssObjectId is already a primary key, no need for an additional index.

Comment on lines 1634 to 1638
- name: idx_SSObject_designation
description: >-
Unique index on the designation column
columns:
- "#SSObject.designation"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want a unique index then you need to define a constraint, not an index, e.g.:

  constraints:
  - name: unique_SSObject_designation
    "@type": Unique
    description: ...
    columns: ["#SSObject.designation"]

closeness to the predicted SSO position. If diaSourceId is the
nearest DiaSource to this SSO prediction, diaSourceDistanceRank=1
would be set. If it is the second nearest, it would be 2, etc.
datatype: int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be short?

Comment on lines +2227 to +2202
description: This is a set of unique identifier_ids in an array that points to the identification_metadata
table.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is identification_metadata? What is the encoding for the array (JSON)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We replicate this table from the MPC, and keep the exact schema (and docs) as upstream. This refers to a different table at the MPC, that's not relevant for the queries we're hoping to support with the replica here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are exposing description is schema browser, people may get confused if you mention something that does not exist.

nullable: false
ivoa:ucd: meta.id;src
- name: object_type
description: Integer to indicate the object type. To be linked (foreign key) to object_type lookup table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no object_type table in this schema.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also a replica from the MPC (including the doc strings). We didn't import object_type (yet) as we don't need it.

Comment on lines 2249 to 2256
- name: idx_current_identifications_packed_primary_provisional_desig
description: Unique index on the packed_primary_provisional_designation column
columns:
- '#current_identifications.packed_primary_provisional_designation'
- name: idx_current_identifications_packed_secondary_provisional_desig
description: Unique index on the packed_secondary_provisional_designation column
columns:
- '#current_identifications.packed_secondary_provisional_designation'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unique indices need to be in constraints:. Is each of these columns unique or only their combination?

ivoa:ucd: time.processing;meta.dataset
indexes:
- name: idx_numbered_identifications_iau_name
description: Unique index on the iau_name column
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same - all unique indices should be constraints.

- name: SSSource
description: LSST-computed per-source quantities. 1:1 relationship with DiaSource.
tap:table_index: 120
primaryKey: '#SSSource.diaSourceId'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we prefer double colons everywhere for consistency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The double colons -- you mean as "1::1" or elsewhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm typing without reading - I mean double quotes 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to convert to double quotes here

@andy-slac
Copy link
Contributor

the dax_apdb code will need to pass "id_generation": True context

This is already on main.

@mjuric mjuric force-pushed the tickets/DM-53310 branch 2 times, most recently from 878b4ec to 185ff4c Compare November 25, 2025 19:44
@mjuric
Copy link
Member Author

mjuric commented Nov 25, 2025

Minor suggestion: changelog update commit can instead be "Add news fragment".

👍 -- updated to "Add news fragment for RFC-1138 (SS* table) changes".

@mjuric mjuric force-pushed the tickets/DM-53310 branch 3 times, most recently from 78e8a4d to 7b11908 Compare November 25, 2025 20:00
@mjuric
Copy link
Member Author

mjuric commented Nov 25, 2025

@andy-slac @JeremyMcCormick I think I've implemented all the review comments (thanks!). I also synced up lsstcam.yaml with comments on apdb.yaml that transfer over.

Ready to be green-lit for merging?

@andy-slac
Copy link
Contributor

Ready to be green-lit for merging?

Approved!

Copy link
Contributor

@isullivan isullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments on formatting.

Comment on lines +1619 to +1621
- '#SSObject.designation'
referencedColumns:
- '#mpc_orbits.designation'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quotes?

- name: SSSource
description: LSST-computed per-source quantities. 1:1 relationship with DiaSource.
tap:table_index: 120
primaryKey: '#SSSource.diaSourceId'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to convert to double quotes here

description: Link an SSSource to its associated DiaSource
'@type': ForeignKey
columns:
- '#SSSource.diaSourceId'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and in the following ~20 lines, use double quotes for quotes in columns

description: Uniqueness of unpacked_primary_provisional_designation
'@type': Unique
columns:
- '#mpc_orbits.unpacked_primary_provisional_designation'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and the next couple columns, use double quotes

"@type": Unique
description: Unique index on the packed_primary_provisional_designation column
columns:
- '#current_identifications.packed_primary_provisional_designation'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and next column, double quotes

@Gerenjie Gerenjie merged commit f775bcd into main Dec 2, 2025
15 checks passed
@Gerenjie Gerenjie deleted the tickets/DM-53310 branch December 2, 2025 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants