This release contains numerous cleanups.
Bugs fixed
- #1087 - Fixed a misuse of the iteration protocol in the
sqliteq
extension. - Ensure that driver exceptions are wrapped when calling
commit
and
rollback
. - #1096 - Fix representation of recursive foreign key relations when using the
model_to_dict
helper. - #1126 - Allow
pskel
to be installed intobin
directory. - #1105 - Added a
Tuple()
type to Peewee to enable expressing arbitrary
tuple expressions in SQL. - #1133 - Fixed bug in the conversion of objects to
Decimal
instances in the
DecimalField
. - Fixed an issue renaming a unique foreign key in MySQL.
- Remove the join predicate from CROSS JOINs.
- #1148 - Ensure indexes are created when a column is added using a schema
migration. - #1165 - Fix bug where the primary key was being overwritten in queries using
the closure-table extension.
New stuff
- Added properties to the
SqliteExtDatabase
to expose commonPRAGMA
settings. For example, to set the cache size to 4MB,db.cache_size = 1000
. - Clarified documentation on calling
commit()
orrollback()
from within the
scope of an atomic block. See docs. - Allow table creation dependencies to be specified using new
depends_on
meta
option. Refs #1076. - Allow specification of the lock type used in SQLite transactions. Previously
this behavior was only present inplayhouse.sqlite_ext.SqliteExtDatabase
,
but it now exists inpeewee.SqliteDatabase
. - Added support for
CROSS JOIN
expressions in select queries. - Docs on how to implement optimistic locking.
- Documented optional dependencies.
- Generic support for specifying select queries as locking the selected rows
FOR X
, e.g.FOR UPDATE
orFOR SHARE
. - Support for specifying the frame-of-reference in window queries, e.g.
specifyingUNBOUNDED PRECEDING
, etc. See docs.
Backwards-incompatible changes
- As of 9e76c99, an
OperationalError
is raised if the user callsconnect()
on an already-open Database object. Previously, the existing connection would
remain open and a new connection would overwrite it, making it impossible to
close the previous connection. If you find this is causing breakage in your
application, you can switch theconnect()
call toget_conn()
which will
only open a connection if necessary. The error is indicative of a real
issue, though, so audit your code for places where you may be opening a
connection without closing it (module-scope operations, e.g.).