Repository navigation
Conversation
run_db_model.py still imported declarative_base() from sqlalchemy.ext.declarative, which SQLAlchemy 2.0 deprecates and reports with a MovedIn20Warning whenever the module is loaded. Import it from sqlalchemy.orm instead, as config_db_model.py already does. Fixes Ericsson#5116
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #5116
run_db_model.pyimporteddeclarative_base()fromsqlalchemy.ext.declarative. Since the requirement is nowsqlalchemy~=2.0.0, loading the module emits:This change imports it from
sqlalchemy.orminstead, the same wayconfig_db_model.pyalready does. Behaviour is unchanged: thesqlalchemy.ormfunction is the one the old location forwards to. No other module in the tree still usessqlalchemy.ext.declarative.Checked with SQLAlchemy 2.0.54:
python -W error::DeprecationWarning -c "import codechecker_server.database.run_db_model"raisesMovedIn20Warningon master and imports cleanly with this change.pytest tests/unitinweb/server(thrift stubs generated locally,test_ccldap.pyskipped because python-ldap isn't installed): the MovedIn20Warning that shows up in the warnings summary on master is gone; pass/fail counts are the same as master (47 passed;test_request_routing::test_postand thetest_git_commit_urlcases fail the same way on master in this environment).test_run_removal_lock.py, which importsrun_db_model, passes.pycodestyle(2.12.0) is clean, andpylint(3.2.x, repo.pylintrc) reports nothing new for the file.