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

Upgrade SQLAlchemy and enable 2.0 warnings #469

Merged
merged 10 commits into from
Oct 25, 2022
Merged

Conversation

amCap1712
Copy link
Member

The same warnings were fixed in LB and BU sometime. Individual commits provide more details.

Depends on metabrainz/brainzutils-python#96

@amCap1712 amCap1712 requested a review from alastair September 27, 2022 10:34
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Collaborator

@alastair alastair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thansk!

@alastair alastair force-pushed the sqlalchemy-warnings branch from b5ae6fb to 1aec033 Compare October 25, 2022 14:31
Passing a string to Connection.execute() is deprecated and will be
removed in version 2.0.  Use the text() construct, or the
Connection.exec_driver_sql() method to invoke a driver-level SQL
string.
(Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)

For rationale, see section:
https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#execute-method-more-strict-execution-options-are-more-prominent
This commit fixes the warning:

The current statement is being autocommitted using implicit autocommit,
which will be removed in SQLAlchemy 2.0. Use the .begin() method of
Engine or Connection in order to use an explicit transaction for DML
and DDL statements.
(Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)

For rationale, see section: https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#library-level-but-not-driver-level-autocommit-removed-from-both-core-and-orm
Builds on #2119

This PR fixes the warning:

Using non-integer/slice indices on Row is deprecated and will be removed in version 2.0; please use row._mapping[], or the mappings() accessor on the Result object.
(Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)

For rationale, see section: https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#result-rows-act-like-named-tuples
To avoid introducing more warnings between now and a future PR that will
switch the future flag to turn these warnings into errors in prod, turn
these warning into errors in tests.
@amCap1712 amCap1712 force-pushed the sqlalchemy-warnings branch from 1aec033 to 042938f Compare October 25, 2022 14:33
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@alastair alastair force-pushed the sqlalchemy-warnings branch from 9311ccc to 9c3e58d Compare October 25, 2022 16:00
@github-actions

This comment has been minimized.

@alastair alastair merged commit f13a8d5 into master Oct 25, 2022
@alastair alastair deleted the sqlalchemy-warnings branch October 25, 2022 16:15
@github-actions
Copy link

Unit Test Results

    1 files  ±0      1 suites  ±0   1m 50s ⏱️ ±0s
201 tests ±0  201 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit f13a8d5. ± Comparison against base commit f13a8d5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants