| 1 |
Version 3.1.1 |
| 2 |
------------- |
| 3 |
|
| 4 |
Released 2023-09-11 |
| 5 |
|
| 6 |
- Deprecate the ``__version__`` attribute. Use feature detection, or |
| 7 |
``importlib.metadata.version("flask-sqlalchemy")``, instead. :issue:`5230` |
| 8 |
|
| 9 |
|
| 10 |
Version 3.1.0 |
| 11 |
------------- |
| 12 |
|
| 13 |
Released 2023-09-11 |
| 14 |
|
| 15 |
- Drop support for Python 3.7. :pr:`1251` |
| 16 |
- Add support for the SQLAlchemy 2.x API via ``model_class`` parameter. :issue:`1140` |
| 17 |
- Bump minimum version of SQLAlchemy to 2.0.16. |
| 18 |
- Remove previously deprecated code. |
| 19 |
- Pass extra keyword arguments from ``get_or_404`` to ``session.get``. :issue:`1149` |
| 20 |
- Fix bug with finding right bind key for clause statements. :issue:`1211` |
| 21 |
|
| 22 |
|
| 23 |
Version 3.0.5 |
| 24 |
------------- |
| 25 |
|
| 26 |
Released 2023-06-21 |
| 27 |
|
| 28 |
- ``Pagination.next()`` enforces ``max_per_page``. :issue:`1201` |
| 29 |
- Improve type hint for ``get_or_404`` return value to be non-optional. :pr:`1226` |
| 30 |
|
| 31 |
|
| 32 |
Version 3.0.4 |
| 33 |
------------- |
| 34 |
|
| 35 |
Released 2023-06-19 |
| 36 |
|
| 37 |
- Fix type hint for ``get_or_404`` return value. :pr:`1208` |
| 38 |
- Fix type hints for pyright (used by VS Code Pylance extension). :issue:`1205` |
| 39 |
|
| 40 |
|
| 41 |
Version 3.0.3 |
| 42 |
------------- |
| 43 |
|
| 44 |
Released 2023-01-31 |
| 45 |
|
| 46 |
- Show helpful errors when mistakenly using multiple ``SQLAlchemy`` instances for the |
| 47 |
same app, or without calling ``init_app``. :pr:`1151` |
| 48 |
- Fix issue with getting the engine associated with a model that uses polymorphic |
| 49 |
table inheritance. :issue:`1155` |
| 50 |
|
| 51 |
|
| 52 |
Version 3.0.2 |
| 53 |
------------- |
| 54 |
|
| 55 |
Released 2022-10-14 |
| 56 |
|
| 57 |
- Update compatibility with SQLAlchemy 2. :issue:`1122` |
| 58 |
|
| 59 |
|
| 60 |
Version 3.0.1 |
| 61 |
------------- |
| 62 |
|
| 63 |
Released 2022-10-11 |
| 64 |
|
| 65 |
- Export typing information instead of using external typeshed definitions. |
| 66 |
:issue:`1112` |
| 67 |
- If default engine options are set, but ``SQLALCHEMY_DATABASE_URI`` is not set, an |
| 68 |
invalid default bind will not be configured. :issue:`1117` |
| 69 |
|
| 70 |
|
| 71 |
Version 3.0.0 |
| 72 |
------------- |
| 73 |
|
| 74 |
Released 2022-10-04 |
| 75 |
|
| 76 |
- Drop support for Python 2, 3.4, 3.5, and 3.6. |
| 77 |
- Bump minimum version of Flask to 2.2. |
| 78 |
- Bump minimum version of SQLAlchemy to 1.4.18. |
| 79 |
- Remove previously deprecated code. |
| 80 |
- The session is scoped to the current app context instead of the thread. This |
| 81 |
requires that an app context is active. This ensures that the session is cleaned up |
| 82 |
after every request. |
| 83 |
- An active Flask application context is always required to access ``session`` and |
| 84 |
``engine``, regardless of if an application was passed to the constructor. |
| 85 |
:issue:`508, 944` |
| 86 |
- Different bind keys use different SQLAlchemy ``MetaData`` registries, allowing |
| 87 |
tables in different databases to have the same name. Bind keys are stored and looked |
| 88 |
up on the resulting metadata rather than the model or table. |
| 89 |
- ``SQLALCHEMY_DATABASE_URI`` does not default to ``sqlite:///:memory:``. An error is |
| 90 |
raised if neither it nor ``SQLALCHEMY_BINDS`` define any engines. :pr:`731` |
| 91 |
- Configuring SQLite with a relative path is relative to ``app.instance_path`` instead |
| 92 |
of ``app.root_path``. The instance folder is created if necessary. :issue:`462` |
| 93 |
- Added ``get_or_404``, ``first_or_404``, ``one_or_404``, and ``paginate`` methods to |
| 94 |
the extension object. These use SQLAlchemy's preferred ``session.execute(select())`` |
| 95 |
pattern instead of the legacy query interface. :issue:`1088` |
| 96 |
- Setup methods that create the engines and session are renamed with a leading |
| 97 |
underscore. They are considered internal interfaces which may change at any time. |
| 98 |
- All parameters to ``SQLAlchemy`` except ``app`` are keyword-only. |
| 99 |
- Renamed the ``bind`` parameter to ``bind_key`` and removed the ``app`` parameter |
| 100 |
from various ``SQLAlchemy`` methods. |
| 101 |
- The extension object uses ``__getattr__`` to alias names from the SQLAlchemy |
| 102 |
package, rather than copying them as attributes. |
| 103 |
- The extension object is stored directly as ``app.extensions["sqlalchemy"]``. |
| 104 |
:issue:`698` |
| 105 |
- The session class can be customized by passing the ``class_`` key in the |
| 106 |
``session_options`` parameter. :issue:`327` |
| 107 |
- ``SignallingSession`` is renamed to ``Session``. |
| 108 |
- ``Session.get_bind`` more closely matches the base implementation. |
| 109 |
- Model classes and the ``db`` instance are available without imports in |
| 110 |
``flask shell``. :issue:`1089` |
| 111 |
- The ``CamelCase`` to ``snake_case`` table name converter handles more patterns |
| 112 |
correctly. If model that was already created in the database changed, either use |
| 113 |
Alembic to rename the table, or set ``__tablename__`` to keep the old name. |
| 114 |
:issue:`406` |
| 115 |
- ``Model`` ``repr`` distinguishes between transient and pending instances. |
| 116 |
:issue:`967` |
| 117 |
- A custom model class can implement ``__init_subclass__`` with class parameters. |
| 118 |
:issue:`1002` |
| 119 |
- ``db.Table`` is a subclass instead of a function. |
| 120 |
- The ``engine_options`` parameter is applied as defaults before per-engine |
| 121 |
configuration. |
| 122 |
- ``SQLALCHEMY_BINDS`` values can either be an engine URL, or a dict of engine options |
| 123 |
including URL, for each bind. ``SQLALCHEMY_DATABASE_URI`` and |
| 124 |
``SQLALCHEMY_ENGINE_OPTIONS`` correspond to the ``None`` key and take precedence. |
| 125 |
:issue:`783` |
| 126 |
- Engines are created when calling ``init_app`` rather than the first time they are |
| 127 |
accessed. :issue:`698` |
| 128 |
- ``db.engines`` exposes the map of bind keys to engines for the current app. |
| 129 |
- ``get_engine``, ``get_tables_for_bind``, and ``get_binds`` are deprecated. |
| 130 |
- SQLite driver-level URIs that look like ``sqlite:///file:name.db?uri=true`` are |
| 131 |
supported. :issue:`998, 1045` |
| 132 |
- SQLite engines do not use ``NullPool`` if ``pool_size`` is 0. |
| 133 |
- MySQL engines use the "utf8mb4" charset by default. :issue:`875` |
| 134 |
- MySQL engines do not set ``pool_size`` to 10. |
| 135 |
- MySQL engines don't set a default for ``pool_recycle`` if not using a queue pool. |
| 136 |
:issue:`803` |
| 137 |
- ``Query`` is renamed from ``BaseQuery``. |
| 138 |
- Added ``Query.one_or_404``. |
| 139 |
- The query class is applied to ``backref`` in ``relationship``. :issue:`417` |
| 140 |
- Creating ``Pagination`` objects manually is no longer a public API. They should be |
| 141 |
created with ``db.paginate`` or ``query.paginate``. :issue:`1088` |
| 142 |
- ``Pagination.iter_pages`` and ``Query.paginate`` parameters are keyword-only. |
| 143 |
- ``Pagination`` is iterable, iterating over its items. :issue:`70` |
| 144 |
- Pagination count query is more efficient. |
| 145 |
- ``Pagination.iter_pages`` is more efficient. :issue:`622` |
| 146 |
- ``Pagination.iter_pages`` ``right_current`` parameter is inclusive. |
| 147 |
- Pagination ``per_page`` cannot be 0. :issue:`1091` |
| 148 |
- Pagination ``max_per_page`` defaults to 100. :issue:`1091` |
| 149 |
- Added ``Pagination.first`` and ``last`` properties, which give the number of the |
| 150 |
first and last item on the page. :issue:`567` |
| 151 |
- ``SQLALCHEMY_RECORD_QUERIES`` is disabled by default, and is not enabled |
| 152 |
automatically with ``app.debug`` or ``app.testing``. :issue:`1092` |
| 153 |
- ``get_debug_queries`` is renamed to ``get_recorded_queries`` to better match the |
| 154 |
config and functionality. |
| 155 |
- Recorded query info is a dataclass instead of a tuple. The ``context`` attribute is |
| 156 |
renamed to ``location``. Finding the location uses a more inclusive check. |
| 157 |
- ``SQLALCHEMY_TRACK_MODIFICATIONS`` is disabled by default. :pr:`727` |
| 158 |
- ``SQLALCHEMY_COMMIT_ON_TEARDOWN`` is deprecated. It can cause various design issues |
| 159 |
that are difficult to debug. Call ``db.session.commit()`` directly instead. |
| 160 |
:issue:`216` |
| 161 |
|
| 162 |
|
| 163 |
Version 2.5.1 |
| 164 |
------------- |
| 165 |
|
| 166 |
Released 2021-03-18 |
| 167 |
|
| 168 |
- Fix compatibility with Python 2.7. |
| 169 |
|
| 170 |
|
| 171 |
Version 2.5.0 |
| 172 |
------------- |
| 173 |
|
| 174 |
Released 2021-03-18 |
| 175 |
|
| 176 |
- Update to support SQLAlchemy 1.4. |
| 177 |
- SQLAlchemy ``URL`` objects are immutable. Some internal methods have changed to |
| 178 |
return a new URL instead of ``None``. :issue:`885` |
| 179 |
|
| 180 |
|
| 181 |
Version 2.4.4 |
| 182 |
------------- |
| 183 |
|
| 184 |
Released 2020-07-14 |
| 185 |
|
| 186 |
- Change base class of meta mixins to ``type``. This fixes an issue caused by a |
| 187 |
regression in CPython 3.8.4. :issue:`852` |
| 188 |
|
| 189 |
|
| 190 |
Version 2.4.3 |
| 191 |
------------- |
| 192 |
|
| 193 |
Released 2020-05-26 |
| 194 |
|
| 195 |
- Deprecate ``SQLALCHEMY_COMMIT_ON_TEARDOWN`` as it can cause various design issues |
| 196 |
that are difficult to debug. Call ``db.session.commit()`` directly instead. |
| 197 |
:issue:`216` |
| 198 |
|
| 199 |
|
| 200 |
Version 2.4.2 |
| 201 |
------------- |
| 202 |
|
| 203 |
Released 2020-05-25 |
| 204 |
|
| 205 |
- Fix bad pagination when records are de-duped. :pr:`812` |
| 206 |
|
| 207 |
|
| 208 |
Version 2.4.1 |
| 209 |
------------- |
| 210 |
|
| 211 |
Released 2019-09-24 |
| 212 |
|
| 213 |
- Fix ``AttributeError`` when using multiple binds with polymorphic models. :pr:`651` |
| 214 |
|
| 215 |
|
| 216 |
Version 2.4.0 |
| 217 |
------------- |
| 218 |
|
| 219 |
Released 2019-04-24 |
| 220 |
|
| 221 |
- Drop support for Python 2.6 and 3.3. :pr:`687` |
| 222 |
- Address SQLAlchemy 1.3 deprecations. :pr:`684` |
| 223 |
- Make engine configuration more flexible. Added the ``engine_options`` parameter and |
| 224 |
``SQLALCHEMY_ENGINE_OPTIONS`` config. Deprecated the individual engine option config |
| 225 |
keys ``SQLALCHEMY_NATIVE_UNICODE``, ``SQLALCHEMY_POOL_SIZE``, |
| 226 |
``SQLALCHEMY_POOL_TIMEOUT``, ``SQLALCHEMY_POOL_RECYCLE``, and |
| 227 |
``SQLALCHEMY_MAX_OVERFLOW``. :pr:`684` |
| 228 |
- ``get_or_404()`` and ``first_or_404()`` now accept a ``description`` parameter to |
| 229 |
control the 404 message. :issue:`636` |
| 230 |
- Use ``time.perf_counter`` for Python 3 on Windows. :issue:`638` |
| 231 |
- Add an example of Flask's tutorial project, Flaskr, adapted for Flask-SQLAlchemy. |
| 232 |
:pr:`720` |
| 233 |
|
| 234 |
|
| 235 |
Version 2.3.2 |
| 236 |
------------- |
| 237 |
|
| 238 |
Released 2017-10-11 |
| 239 |
|
| 240 |
- Don't mask the parent table for single-table inheritance models. :pr:`561` |
| 241 |
|
| 242 |
|
| 243 |
Version 2.3.1 |
| 244 |
------------- |
| 245 |
|
| 246 |
Released 2017-10-05 |
| 247 |
|
| 248 |
- If a model has a table name that matches an existing table in the metadata, use that |
| 249 |
table. Fixes a regression where reflected tables were not picked up by models. |
| 250 |
:issue:`551` |
| 251 |
- Raise the correct error when a model has a table name but no primary key. :pr:`556` |
| 252 |
- Fix ``repr`` on models that don't have an identity because they have not been |
| 253 |
flushed yet. :issue:`555` |
| 254 |
- Allow specifying a ``max_per_page`` limit for pagination, to avoid users specifying |
| 255 |
high values in the request args. :pr:`542` |
| 256 |
- For ``paginate`` with ``error_out=False``, the minimum value for ``page`` is 1 and |
| 257 |
``per_page`` is 0. :issue:`558` |
| 258 |
|
| 259 |
|
| 260 |
Version 2.3.0 |
| 261 |
------------- |
| 262 |
|
| 263 |
Released 2017-09-28 |
| 264 |
|
| 265 |
- Multiple bugs with ``__tablename__`` generation are fixed. Names will be generated |
| 266 |
for models that define a primary key, but not for single-table inheritance |
| 267 |
subclasses. Names will not override a ``declared_attr``. ``PrimaryKeyConstraint`` is |
| 268 |
detected. :pr:`541` |
| 269 |
- Passing an existing ``declarative_base()`` as ``model_class`` to |
| 270 |
``SQLAlchemy.__init__`` will use this as the base class instead of creating one. |
| 271 |
This allows customizing the metaclass used to construct the base. :issue:`546` |
| 272 |
- The undocumented ``DeclarativeMeta`` internals that the extension uses for binds and |
| 273 |
table name generation have been refactored to work as mixins. Documentation is added |
| 274 |
about how to create a custom metaclass that does not do table name generation. |
| 275 |
:issue:`546` |
| 276 |
- Model and metaclass code has been moved to a new ``models`` module. |
| 277 |
``_BoundDeclarativeMeta`` is renamed to ``DefaultMeta``; the old name will be |
| 278 |
removed in 3.0. :issue:`546` |
| 279 |
- Models have a default ``repr`` that shows the model name and primary key. :pr:`530` |
| 280 |
- Fixed a bug where using ``init_app`` would cause connectors to always use the |
| 281 |
``current_app`` rather than the app they were created for. This caused issues when |
| 282 |
multiple apps were registered with the extension. :pr:`547` |
| 283 |
|
| 284 |
|
| 285 |
Version 2.2 |
| 286 |
----------- |
| 287 |
|
| 288 |
Released 2017-02-27, codename Dubnium |
| 289 |
|
| 290 |
- Minimum SQLAlchemy version is 0.8 due to use of ``sqlalchemy.inspect``. |
| 291 |
- Added support for custom ``query_class`` and ``model_class`` as args to the |
| 292 |
``SQLAlchemy`` constructor. :pr:`328` |
| 293 |
- Allow listening to SQLAlchemy events on ``db.session``. :pr:`364` |
| 294 |
- Allow ``__bind_key__`` on abstract models. :pr:`373` |
| 295 |
- Allow ``SQLALCHEMY_ECHO`` to be a string. :issue:`409` |
| 296 |
- Warn when ``SQLALCHEMY_DATABASE_URI`` is not set. :pr:`443` |
| 297 |
- Don't let pagination generate invalid page numbers. :issue:`460` |
| 298 |
- Drop support of Flask < 0.10. This means the db session is always tied to the app |
| 299 |
context and its teardown event. :issue:`461` |
| 300 |
- Tablename generation logic no longer accesses class properties unless they are |
| 301 |
``declared_attr``. :issue:`467` |
| 302 |
|
| 303 |
|
| 304 |
Version 2.1 |
| 305 |
----------- |
| 306 |
|
| 307 |
Released 2015-10-23, codename Caesium |
| 308 |
|
| 309 |
- Table names are automatically generated in more cases, including subclassing mixins |
| 310 |
and abstract models. |
| 311 |
- Allow using a custom MetaData object. |
| 312 |
- Add support for binds parameter to session. |
| 313 |
|
| 314 |
|
| 315 |
Version 2.0 |
| 316 |
----------- |
| 317 |
|
| 318 |
Released 2014-08-29, codename Bohrium |
| 319 |
|
| 320 |
- Changed how the builtin signals are subscribed to skip non-Flask-SQLAlchemy |
| 321 |
sessions. This will also fix the attribute error about model changes not existing. |
| 322 |
- Added a way to control how signals for model modifications are tracked. |
| 323 |
- Made the ``SignallingSession`` a public interface and added a hook for customizing |
| 324 |
session creation. |
| 325 |
- If the ``bind`` parameter is given to the signalling session it will no longer cause |
| 326 |
an error that a parameter is given twice. |
| 327 |
- Added working table reflection support. |
| 328 |
- Enabled autoflush by default. |
| 329 |
- Consider ``SQLALCHEMY_COMMIT_ON_TEARDOWN`` harmful and remove from docs. |
| 330 |
|
| 331 |
|
| 332 |
Version 1.0 |
| 333 |
----------- |
| 334 |
|
| 335 |
Released 2013-07-20, codename Aurum |
| 336 |
|
| 337 |
- Added Python 3.3 support. |
| 338 |
- Dropped Python 2.5 compatibility. |
| 339 |
- Various bugfixes. |
| 340 |
- Changed versioning format to do major releases for each update now. |
| 341 |
|
| 342 |
|
| 343 |
Version 0.16 |
| 344 |
------------ |
| 345 |
|
| 346 |
- New distribution format (flask_sqlalchemy). |
| 347 |
- Added support for Flask 0.9 specifics. |
| 348 |
|
| 349 |
|
| 350 |
Version 0.15 |
| 351 |
------------ |
| 352 |
|
| 353 |
- Added session support for multiple databases. |
| 354 |
|
| 355 |
|
| 356 |
Version 0.14 |
| 357 |
------------ |
| 358 |
|
| 359 |
- Make relative sqlite paths relative to the application root. |
| 360 |
|
| 361 |
|
| 362 |
Version 0.13 |
| 363 |
------------ |
| 364 |
|
| 365 |
- Fixed an issue with Flask-SQLAlchemy not selecting the correct binds. |
| 366 |
|
| 367 |
|
| 368 |
Version 0.12 |
| 369 |
------------ |
| 370 |
|
| 371 |
- Added support for multiple databases. |
| 372 |
- Expose ``BaseQuery`` as ``db.Query``. |
| 373 |
- Set default ``query_class`` for ``db.relation``, ``db.relationship``, and |
| 374 |
``db.dynamic_loader`` to ``BaseQuery``. |
| 375 |
- Improved compatibility with Flask 0.7. |
| 376 |
|
| 377 |
|
| 378 |
Version 0.11 |
| 379 |
------------ |
| 380 |
|
| 381 |
- Fixed a bug introduced in 0.10 with alternative table constructors. |
| 382 |
|
| 383 |
|
| 384 |
Version 0.10 |
| 385 |
------------ |
| 386 |
|
| 387 |
- Added support for signals. |
| 388 |
- Table names are now automatically set from the class name unless overridden. |
| 389 |
- ``Model.query`` now always works for applications directly passed to the |
| 390 |
``SQLAlchemy`` constructor. Furthermore the property now raises a ``RuntimeError`` |
| 391 |
instead of being ``None``. |
| 392 |
- Added session options to constructor. |
| 393 |
- Fixed a broken ``__repr__``. |
| 394 |
- ``db.Table`` is now a factory function that creates table objects. This makes it |
| 395 |
possible to omit the metadata. |
| 396 |
|
| 397 |
|
| 398 |
Version 0.9 |
| 399 |
----------- |
| 400 |
|
| 401 |
- Applied changes to pass the Flask extension approval process. |
| 402 |
|
| 403 |
|
| 404 |
Version 0.8 |
| 405 |
----------- |
| 406 |
|
| 407 |
- Added a few configuration keys for creating connections. |
| 408 |
- Automatically activate connection recycling for MySQL connections. |
| 409 |
- Added support for the Flask testing mode. |
| 410 |
|
| 411 |
|
| 412 |
Version 0.7 |
| 413 |
----------- |
| 414 |
|
| 415 |
- Initial public release |