There are some attributes of the image (like MJD) that can be queried on for other classes, but only using a join.
For example we can get all SourceList objects with a certain MJD using:
session.scalars(sa.select(SourceList).join(Image).where(Image.mjd == some_mjd)).all()
But we cannot currently do something intuitive like this:
session.scalars(sa.select(SourceList).where(SourceList.mjd == some_mjd)).all()
To do that we'd have to make a hybrid property that folds the additional tables into an expression using a scalar subquery.
This may be more complicated (and slow) than is worth actually fixing.
There are some attributes of the image (like MJD) that can be queried on for other classes, but only using a join.
For example we can get all SourceList objects with a certain MJD using:
session.scalars(sa.select(SourceList).join(Image).where(Image.mjd == some_mjd)).all()
But we cannot currently do something intuitive like this:
session.scalars(sa.select(SourceList).where(SourceList.mjd == some_mjd)).all()
To do that we'd have to make a hybrid property that folds the additional tables into an expression using a scalar subquery.
This may be more complicated (and slow) than is worth actually fixing.
Some references: https://docs.sqlalchemy.org/en/20/orm/extensions/hybrid.html#join-dependent-relationship-hybrid
https://stackoverflow.com/questions/19979303/hybrid-property-with-join-in-sqlalchemy
https://stackoverflow.com/questions/57578366/how-to-make-sqlalchemy-hybrid-property-select-expressions-work-for-both-select-a