-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frontend: Add backref relationship between Package and Build to silence sqlalchemy warnings #3032
Conversation
c319ac6
to
a11acf1
Compare
Is the testsuite failing because of the change? |
We already have this class Package(db.Model, helpers.Serializer, CoprSearchRelatedData):
...
builds = db.relationship("Build", order_by="Build.id") which IMHO causes the collision |
a11acf1
to
ff8ae32
Compare
Yes, thank you. Unluckily... I cannot make alembic work locally on my machine to make migration. Could it somehow be because of the move to F39? |
What does it mean? A traceback, or ...? |
When I run |
... to silence sqlalchemy warnings The Package.builds column is used only for read only purposes and needs to be ordered accordingly against Build.id. Removing viewonly=True parameter and making it read-write column will result in errors since the relationship is used only for loading objects and not for any persistence operation. Setting the relationship to read-write would result in errors since the relationship.sync_backref flag is set to True and sqlalchemy tries then to sync the Package.builds column which was never commited - thus "This session is in 'committed' state; no further SQL can be emitted within this transaction." will appear.
Fixed that, pelase look to commit message for explanation |
ff8ae32
to
876983a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you.
Fixes #2445