-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Towards SQLAlchemy 2.0: use model attributes instead of strings #15340
Conversation
94dfbda
to
9886779
Compare
9886779
to
0e166e5
Compare
joinedload(trans.app.model.StoredWorkflow.annotations), | ||
joinedload(trans.app.model.StoredWorkflow.tags), | ||
subqueryload(trans.app.model.StoredWorkflow.latest_workflow) | ||
.joinedload(trans.app.model.Workflow.steps) |
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.
You can use model.* instead of trans.app, right ?
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.
Oh, absolutely! There were a few other similar cases - I thought it might be better to group all those changes in a "cleanup" PR after I'm done with all the relevant SA 2.0 updates to Query/select() not to mix them with strictly functional stuff in case something breaks and we need to bisect lots of commits, etc.
Is it possible that your PR base is outdated (https://github.com/galaxyproject/galaxy/actions/runs/3972186298/jobs/6809828434#step:10:20)? |
As far as I can tell, that test fails on the latest dev branch. I didn't look closely, but I suspect it may have been caused by a forward merge (our type checks have become more strict, so what worked on 22.05 could have broken tests on dev). I'll try to fix it on Monday. |
0e166e5
to
4725e06
Compare
@mvdbeek your PR fixed the typing error - thank you! |
Added in galaxyproject#15340 by accident. Fixes: ``` RuntimeError: No active exception to reraise File "galaxy/web/framework/decorators.py", line 337, in decorator rval = func(self, trans, *args, **kwargs) File "galaxy/webapps/galaxy/api/library_contents.py", line 130, in index for content in traverse(library.root_folder): File "galaxy/webapps/galaxy/api/library_contents.py", line 84, in traverse can_access, folder_ids = trans.app.security_agent.check_folder_contents( File "galaxy/model/security.py", line 1510, in check_folder_contents raise ``` in https://sentry.galaxyproject.org/share/issue/38df4490ff61415090c319ad0e16f1fa/
Ref. #12541
Ref. SA docs: ORM Query - Joining / loading on relationships uses attributes, not strings
This is done. I did not do any additional refactoring intentionally: there will be more updates to the Query objects in follow-up PRs.
NOTE: There are more relevant cases of this type in the code base; I'll try to group them all (or most of them) in one PR before moving this out of WIP status.How to test the changes?
(Select all options that apply)
License