This is a feature release, which includes new features and removes previously deprecated code. The 3.0.x branch is now the supported bug fix branch, the 2.x branch will become a tag marking the end of support for that branch. We encourage everyone to upgrade, and to use a tool such as pip-tools to pin all dependencies and control upgrades.
This is a prerelease to preview the changes in 3.0, the next feature release. Prereleases are an opportunity to test and update your projects early before the final release.
pip install -U --pre Flask-SQLAlchemy
There were significant changes in pallets-eco/flask-sqlalchemy#1087, see the changelog for a full list. Many of those changes will raise deprecation warnings, but it was not feasible to implement warnings for some things.
This is a prerelease to preview the changes in 3.0, the next feature release. Prereleases are an opportunity to test and update your projects early before the final release.
pip install -U --pre Flask-SQLAlchemy
There were significant changes in pallets-eco/flask-sqlalchemy#1087, see the changelog for a full list. Many of those changes will raise deprecation warnings, but it was not feasible to implement warnings for some things.
The session is scoped to the current app context instead of the thread. This
requires that an app context is active. This ensures that the session is cleaned up
after every request.
An active Flask application context is always required to access session and
engine, regardless of if an application was passed to the constructor.
:issue:508, 944
Different bind keys use different SQLAlchemy MetaData registries, allowing
tables in different databases to have the same name. Bind keys are stored and looked
up on the resulting metadata rather than the model or table.
SQLALCHEMY_DATABASE_URI does not default to sqlite:///:memory:. An error is
raised if neither it nor SQLALCHEMY_BINDS define any engines. :pr:731
Configuring SQLite with a relative path is relative to app.instance_path instead
of app.root_path. The instance folder is created if necessary. :issue:462
Added get_or_404, first_or_404, one_or_404, and paginate methods to
the extension object. These use SQLAlchemy's preferred session.execute(select())
pattern instead of the legacy query interface. :issue:1088
Setup methods that create the engines and session are renamed with a leading
underscore. They are considered internal interfaces which may change at any time.
All parameters to SQLAlchemy except app are keyword-only.
Renamed the bind parameter to bind_key and removed the app parameter
from various SQLAlchemy methods.
The extension object uses __getattr__ to alias names from the SQLAlchemy
package, rather than copying them as attributes.
The extension object is stored directly as app.extensions["sqlalchemy"].
:issue:698
The session class can be customized by passing the class_ key in the
session_options parameter. :issue:327
SignallingSession is renamed to Session.
Session.get_bind more closely matches the base implementation.
Model classes and the db instance are available without imports in
flask shell. :issue:1089
The CamelCase to snake_case table name converter handles more patterns
correctly. If model that was already created in the database changed, either use
Alembic to rename the table, or set __tablename__ to keep the old name.
:issue:406
Modelrepr distinguishes between transient and pending instances.
:issue:967
A custom model class can implement __init_subclass__ with class parameters.
:issue:1002
db.Table is a subclass instead of a function.
The engine_options parameter is applied as defaults before per-engine
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps flask-sqlalchemy from 2.5.1 to 3.0.0.
Release notes
Sourced from flask-sqlalchemy's releases.
Changelog
Sourced from flask-sqlalchemy's changelog.
... (truncated)
Commits
c84cc48
release version 3.0.0 (#1110)3958b1d
release version 3.0.0a36433a
update dev dependencies30749e8
[pre-commit.ci] pre-commit autoupdate (#1109)41e7d63
[pre-commit.ci] pre-commit autoupdate4875ffe
use metadata from custom declarative base class (#1108)6a82416
pin importlib-metadata until pdm is compatibleeaea2e7
default metadata from existing declarative model class8782fba
use pyproject.toml and PDM (#1107)02a10f3
use pyproject.toml and pdmDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)