[Flask] Flask-SQLAlchemy 2.3.0 released

David Lord davidism at gmail.com
Thu Sep 28 10:28:57 EDT 2017


We've released Flask-SQLAlchemy 2.3.0! This mainly fixes issues with
`__tablename__` generation introduced in 2.2. Hopefully name
generation Just Works™️ for all your use cases, but in case it doesn't
there's also a documented way to disable it.
https://github.com/mitsuhiko/flask-sqlalchemy/releases/tag/2.3.0

Install or upgrade with pip:

    pip install -U Flask-SQLAlchemy

## Changelog

- Multiple bugs with ``__tablename__`` generation are fixed. Names will be
  generated for models that define a primary key, but not for single-table
  inheritance subclasses. Names will not override a ``declared_attr``.
  ``PrimaryKeyConstraint`` is detected. (`#541`_)
- Passing an existing ``declarative_base()`` as ``model_class`` to
  ``SQLAlchemy.__init__`` will use this as the base class instead of creating
  one. This allows customizing the metaclass used to construct the base.
  (`#546`_)
- The undocumented ``DeclarativeMeta`` internals that the extension uses for
  binds and table name generation have been refactored to work as mixins.
  Documentation is added about how to create a custom metaclass that does not
  do table name generation. (`#546`_)
- Model and metaclass code has been moved to a new ``models`` module.
  ``_BoundDeclarativeMeta`` is renamed to ``DefaultMeta``; the old name will be
  removed in 3.0. (`#546`_)
- Models have a default ``repr`` that shows the model name and primary key.
  (`#530`_)
- Fixed a bug where using ``init_app`` would cause connectors to always use the
  ``current_app`` rather than the app they were created for. This caused issues
  when multiple apps were registered with the extension. (`#547`_)

.. _#530: https://github.com/mitsuhiko/flask-sqlalchemy/pull/530
.. _#541: https://github.com/mitsuhiko/flask-sqlalchemy/pull/541
.. _#546: https://github.com/mitsuhiko/flask-sqlalchemy/pull/546
.. _#547: https://github.com/mitsuhiko/flask-sqlalchemy/pull/547

---

We are still working towards larger changes in a 3.0 release, and
would appreciate any help, big or small. Whether it's triaging issues,
updating and improving the docs, finding bugs, or squashing bugs,
everything helps!

---

Finally, if you want to, please retweet this to spread the word to
more developers:

   https://twitter.com/davidism/status/913409932514410502

Thank you for your continued support and patience!


More information about the Flask mailing list