Repository navigation
2.7.0
New APIs, features, and performance improvements.
Notable changes and new features
PasswordFieldthat uses thebcryptmodule.- Added new Model
Meta.only_save_dirtyflag to, by default, only save fields that have been modified. - Added support for
upsert()on MySQL (in addition to SQLite). - Implemented SQLite ranking functions (
rankandbm25) in Cython, and changed both the Cython and Python APIs to accept weight values for every column in the search index. This more closely aligns with the APIs provided by FTS5. In fact, made the APIs for FTS4 and FTS5 result ranking compatible. - Major changes to the :ref:
sqlite_extmodule. Function callbacks implemented in Python were implemented in Cython (e.g. date manipulation and regex processing) and will be used if Cython is available when Peewee is installed. - Support for the experimental new FTS5 SQLite search extension.
- Added :py:class:
SearchFieldfor use with the SQLite FTS extensions. - Added :py:class:
RowIDFieldfor working with the specialrowidcolumn in SQLite. - Added a model class validation hook to allow model subclasses to perform any validation after class construction. This is currently used to ensure that
FTS5Modelsubclasses do not violate any rules required by the FTS5 virtual table.
Bugs fixed
- #751, fixed some very broken behavior in the MySQL migrator code. Added more tests.
- #718, added a
RetryOperationalErrormixin that will try automatically reconnecting after a failed query. There was a bug in the previous error handler implementation that made this impossible, which is also fixed.
Small bugs
- #713, fix column name regular expression in SQLite migrator.
- #724, fixed
NULLhandling with the PostgresqlJSONField. - #725, added
__module__attribute toDoesNotExistclasses. - #727, removed the
commit_selectlogic for MySQL databases. - #730, added documentation for
Meta.order_byAPI. - #745, added
cast()method for casting JSON field values. - #748, added docs and method override to indicate that SQLite does not support adding foreign key constraints after table creation.
- Check whether pysqlite or libsqlite were compiled with BerkeleyDB support when using the :py:class:
BerkeleyDatabase. - Clean up the options passed to SQLite virtual tables on creation.
Small features
- #700, use sensible default if field's declared data-type is not present in the field type map.
- #707, allow model to be specified explicitly in
prefetch(). - #734, automatic testing against python 3.5.
- #753, added support for
upsert()ith MySQL via theREPLACE INTO ...statement. - #757,
pwiz, the schema intropsection tool, will now generate multi-column index declarations. - #756,
pwizwill capture passwords using thegetpass()function rather than via the command-line. - Removed
Database.sql_error_handler(), replaced with theRetryOperationalErrormixin class. - Documentation for
Meta.order_byandMeta.primary_key. - Better documentation around column and table constraints.
- Improved performance for some methods that are called frequently.
- Added
coerceparameter toBareFieldand added documentation.