Move database access code out of galaxy.util
#16526
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This removes database access code from the
galaxy.util
package. Package tests currently pass because such code is invoked indirectly, throughtrans.sa_session
withtrans
passed as an argument. However, refactoring towards SA 2.0 (replacing the legacyquery
object withselect
) exposes this and tests fail (we have tofrom sqlalchemy import select
, andsqlalchemy
is not available to thegalaxy.util
package; discovered in #16434).There were 2 such instances in the util package:
The
get_user_by_username
function is moved as a standalone function intomanagers.users
. (this is currently failing 2 tests -- I'm investigating)The
dbkeys
module is moved into themanagers
package.The data access code in
dbkeys
can be easily extracted into 2 functions which can be moved tomanagers.hdas
. However, the calling code fromdbkeys
would still have to be moved out of theutil
package, otherwise it would have to import frommanagers
. Is there a better way to rearrange this?How to test the changes?
(Select all options that apply)
License