Skip to content
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

Move database access code out of galaxy.util #16526

Merged
merged 6 commits into from Aug 9, 2023

Conversation

jdavcs
Copy link
Member

@jdavcs jdavcs commented Aug 7, 2023

This removes database access code from the galaxy.util package. Package tests currently pass because such code is invoked indirectly, through trans.sa_session with trans passed as an argument. However, refactoring towards SA 2.0 (replacing the legacy query object with select) exposes this and tests fail (we have to from sqlalchemy import select, and sqlalchemy is not available to the galaxy.util package; discovered in #16434).

There were 2 such instances in the util package:

  1. The get_user_by_username function is moved as a standalone function into managers.users. (this is currently failing 2 tests -- I'm investigating)

  2. The dbkeys module is moved into the managers package.

    The data access code in dbkeys can be easily extracted into 2 functions which can be moved to managers.hdas. However, the calling code from dbkeys would still have to be moved out of the util package, otherwise it would have to import from managers. Is there a better way to rearrange this?

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@jdavcs jdavcs added kind/refactoring cleanup or refactoring of existing code, no functional changes area/toolshed area/database Galaxy's database or data access layer area/util labels Aug 7, 2023
@jdavcs jdavcs added this to the 23.2 milestone Aug 7, 2023
@jdavcs jdavcs marked this pull request as ready for review August 7, 2023 23:30
@jdavcs jdavcs requested a review from a team August 7, 2023 23:30
@jdavcs jdavcs marked this pull request as draft August 8, 2023 02:38
@jdavcs jdavcs marked this pull request as ready for review August 8, 2023 05:06
@jdavcs
Copy link
Member Author

jdavcs commented Aug 8, 2023

Package test failure unrelated. Ready for review.

@nsoranzo nsoranzo changed the title Move dabase access code out of galaxy.util Move database access code out of galaxy.util Aug 9, 2023
@nsoranzo nsoranzo changed the title Move database access code out of galaxy.util Move database access code out of galaxy.util Aug 9, 2023
lib/galaxy/managers/dbkeys.py Outdated Show resolved Hide resolved
lib/galaxy/managers/dbkeys.py Outdated Show resolved Hide resolved
@jmchilton jmchilton merged commit be76d7f into galaxyproject:dev Aug 9, 2023
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database Galaxy's database or data access layer area/toolshed area/util kind/refactoring cleanup or refactoring of existing code, no functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants