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
Resolve all sqlalchemy.exc.RemovedIn20Warnings #123
Merged
Merged
Conversation
This file contains 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
Set up pytest to raise exception for `sqlalchemy.exc.RemovedIn20Warning` warnings by default. Ignore the warnings that are triggered by the test suite. Refs #111
Use `text()` construct to wrap plain string SQL statements to avoid the following `RemovedIn20Warning`: Using plain strings to indicate SQL statements without using the text() construct is deprecated and will be removed in version 2.0. Ensure plain SQL statements are passed using the text() construct. Refs #111
The `declarative_base()` function has moved to `sqlalchemy.orm` in SQLAlchemy 2.0. Change the docs to use the new location. Refs #111
The `declarative_base()` function has moved to `sqlalchemy.orm` in SQLAlchemy 2.0. Change the tests to use the new location. Refs #111
The `autoload` parameter is deprecated in SQLAlchemy 1.4 and will be removed in version 2.0. The `autoload_with` parameter is already used, so just remove the deprecated `autoload` parameter. Refs #111.
Use `Engine.begin()` to start a transaction and `Connection.execute()` over `Engine.execute()` in tests to resolve the following warnings: The Engine.execute() method is considered legacy as of the 1.x series of SQLAlchemy and will be removed in 2.0. All statement execution in SQLAlchemy 2.0 is performed by the Connection.execute() method of Connection, or in the ORM by the Session.execute() method of Session. 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. Refs #111
Use SQLAlchemy's compilation extension to build the SQL for creating and dropping the search functions and triggers. This resolves the following deprecation warning: The connection.execute() method in SQLAlchemy 2.0 will accept parameters as a single dictionary or a single sequence of dictionaries only. Parameters passed as keyword arguments, tuples or positionally oriened dictionaries and/or tuples will no longer be accepted. BREAKING CHANGE: `quote_identifier` function has been removed. BREAKING CHANGE: `SearchManager.search_function_ddl` method has been removed. Use `CreateSearchFunctionSQL(column)` instead. BREAKING CHANGE: `SearchManager.search_trigger_ddl` method has been removed. Use `CreateSearchTriggerSQL(column)` instead. Refs #111
Wrap the raw SQL queries passed to `Connection.execute()` with `text()` construct. This resolves the following deprecation warning: 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. Refs #111
jpvanhal
force-pushed
the
resolve-sqlalchemy-2-warnings
branch
from
August 7, 2023 20:03
1030f92
to
54f7895
Compare
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.
Refs #111