Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
cache: pip
cache-dependency-path: requirements*/*.txt
- name: cache mypy
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
uses: actions/cache@v4 # v4.1.2
with:
path: ./.mypy_cache
key: mypy|${{ hashFiles('pyproject.toml') }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 3.1.3
-------------

- Use ``SQLALCHEMY_ENGINE_OPTIONS`` as default engine options specifically when engine options is not specified in ``SQLALCHEMY_BINDS``. :issue:`1396`


Version 3.1.2
-------------

Expand Down
1 change: 1 addition & 0 deletions src/flask_sqlalchemy/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ def init_app(self, app: Flask) -> None:
engine_options[key] = self._engine_options.copy()

if isinstance(value, (str, sa.engine.URL)):
engine_options[key].update(basic_engine_options)
engine_options[key]["url"] = value
else:
engine_options[key].update(value)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_init_engine_options(app: Flask, model_class: t.Any) -> None:
app.config["SQLALCHEMY_BINDS"] = {"a": "sqlite://"}
db = SQLAlchemy(app, engine_options={"echo": True}, model_class=model_class)
# init is default
assert db.engines["a"].echo
assert not db.engines["a"].echo
# config overrides init
assert not db.engine.echo

Expand Down
Loading