astrodbtoolkit / astrodbtoolkit/astrodb-template-db

sqlalchemy warning about conflicting relationships

Open
#131 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3
Forks
5
Avg merge
34m
Merged PRs (30d)
2

Description

Pytest shows a bunch of warnings like this:
```
SAWarning: relationship 'Publications.telescopes_collection' will copy column
Publications.reference to column Telescopes.reference, which conflicts with relationship(s):
'Publications.telescopes_collection' (copies Publications.reference to Telescopes.reference),
'Telescopes.publications' (copies Publications.reference to Telescopes.reference).
If this is not the intention, consider if these relationships should be linked
with back_populates, or if viewonly=True should be applied to one or
more if they are read-only.
For the less common case that foreign key constraints are partially overlapping,
the orm.foreign() annotation can be used to isolate the columns that should be
written towards.

To silence this warning, add the parameter
'overlaps="publications,telescopes_collection"' to the
'Publications.telescopes_collection' relationship.
(Background on this warning at: https://sqlalche.me/e/20/qzyx)
(This warning originated from the `configure_mappers()` process, which was invoked
automatically in response to a user-initiated operation.)
```
The help page is useful but I don't know which option to pick (back populate or viewonly?) and I don't know how to add it to schema with felis.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Felis schema definitions for Publications and Telescopes, then run pytest to reproduce the SQLAlchemy warnings. Read the relationship configuration alongside the linked SQLAlchemy warning guidance to determine whether the relationships should be linked or read-only. Done means the warning is resolved without changing the intended relationship behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlalchemy
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.