Changelog History
Page 10
-
v2.9.0 Changes
๐ In this release there are two notable changes:
- The
Model.create_or_get()
method was removed. See the documentation for an example of the code one would write to replicate this functionality. - ๐ The SQLite closure table extension gained support for many-to-many relationships thanks to a nice PR by @necoro. Docs.
- The
-
v2.8.8 Changes
๐ This release contains a single important bugfix for a regression in specifying ๐ the type of lock to use when opening a SQLite transaction.
-
v2.8.7 Changes
๐ 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
androllback
. - #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 theDecimalField
. - ๐ 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 in
playhouse.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.
specifying
UNBOUNDED 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.).
- ๐ #1087 - Fixed a misuse of the iteration protocol in the
-
v2.8.6 Changes
๐ This release was later removed due to containing a bug. See notes on 2.8.7.
-
v2.8.5 Changes
๐ This release contains two small bugfixes.
- ๐ #1081 - fixed the use of parentheses in compound queries on MySQL.
- ๐ Fixed some grossness in a helper function used by
prefetch
that was clearing out theGROUP BY
andHAVING
clauses of sub-queries.
-
v2.8.4 Changes
๐ This release contains bugfixes as well as a new playhouse extension module for โ working with SQLite in multi-threaded / concurrent environments. The new module is called
playhouse.sqliteq
and it works by serializing ๐ queries using a dedicated worker thread (or greenlet). The performance is quite good, hopefully this proves useful to someone besides myself! You can learn ๐ more by reading the sqliteq documentation.๐จ As a miscellaneous note, I did some major refactoring and cleanup in
ExtQueryResultsWrapper
and it's corollary in thespeedups
module. The code is much easier to read than before.๐ Bugs fixed
- #1061 - @akrs patched a bug in
TimestampField
which affected the accuracy of sub-second timestamps (for resolution > 1). - #1071, small python 3 fix.
- #1072, allow
DeferredRelation
to be used multiple times if there are multiple references to a given deferred model. - ๐ #1073, fixed regression in the speedups module that caused SQL functions to
always coerce return values, regardless of the
coerce
flag. - #1083, another Python 3 issue - this time regarding the use of
exc.message
.
- #1061 - @akrs patched a bug in
-
v2.8.3 Changes
๐ This release contains bugfixes and a small backwards-incompatible change to the way foreign key
ObjectIdDescriptor
is named (issue #1050).๐ Bugs fixed and general changes
- #1028 - allow the
ensure_join
method to accepton
andjoin_type
parameters. Thanks @paulbooth. - #1032 - fix bug related to coercing model instances to database parameters when the model's primary key is a foreign key.
- #1035 - fix bug introduced in 2.8.2, where I had added some logic to try and
restrict the base
Model
class from being treated as a "real" Model. - #1039 - update documentation to clarify that lists or tuples are acceptable
values when specifying SQLite
PRAGMA
statements. - #1041 - PyPy user was unable to install Peewee. (Who in their right mind would ever use PyPy?!) Bug was fixed by removing the pre-generated C files from the distribution.
- #1043 - fix bug where the
speedups
C extension was not calling the correct model initialization method, resulting in model instances returned as results of a query having theirdirty
flag incorrectly set. - 0๏ธโฃ #1048 - similar to #1043, add logic to ensure that fields with default values are considered dirty when instantiating the model.
- โก๏ธ #1049 - update URL to APSW.
- ๐ Fixed unreported bug regarding
TimestampField
with zero values reporting the incorrect datetime.
๐ New stuff
- โ djpeewee extension module now works with Django 1.9.
- โ TimestampField is now an officially documented field.
- #1050 - use the
db_column
of aForeignKeyField
for the name of theObjectIdDescriptor
, except when thedb_column
and fieldname
are the same, in which case the ID descriptor will be named<field_name>_id
.
- #1028 - allow the
-
v2.8.2 Changes
๐ This release contains mostly bug-fixes, clean-ups, and API enhancements.
๐ Bugs fixed and general cleanups
- ๐ #820 - fixed some bugs related to the Cython extension build process.
- #858 - allow blanks and perform type conversion when using the
db_url
extension - #922 - ensure that
peewee.OperationalError
is raised consistently when using theRetryOperationalError
mixin. - #929 - ensure that
pwiz
will import the appropriate extensions when vendor-specific fields are used. - #930 - ensure that
pwiz
-generated models containingUnknownField
placeholders do not blow up when you instantiate them. - #932 - correctly limit the length of automatically-generated index names.
- ๐ #933 - fixed bug where
BlobField
could not be used if it's parent model pointed to an uninitialized databaseProxy
. - #935 - greater consistency with the conversion to Python data-types when
performing aggregations, annotations, or calling
scalar()
. - #939 - ensure the correct data-types are used when initializing a connection pool.
- ๐ฆ #947 - fix bug where
Signal
subclasses were not returning rows affected on save. - โ #951 - better warnings regarding C extension compilation, thanks @dhaase-de.
- #968 - fix bug where table names starting with numbers generated invalid
table names when using
pwiz
. - #971 - fix bug where parameter was not being used. Thanks @jberkel.
- ๐ #974 - fixed the way
SqliteExtDatabase
handles the automaticrowid
(anddocid
) columns. Thanks for alerting me to the issue and providing a failing test case @jberkel. - #976 - fix obscure bug relating to cloning foreign key fields twice.
- #981 - allow
set
instances to be used on the right-hand side ofIN
exprs. - 0๏ธโฃ #983 - fix behavior where the default
id
primary key was inherited regardless. When users would inadvertently include it in their queries, it would use the table alias of it's parent class. - ๐ #992 - add support for
db_column
indjpeewee
- #995 - fix the behavior of
truncate_date
with Postgresql. Thanks @Zverik. - #1011 - correctly handle
bytes
wrapper used byPasswordField
tobytes
. - #1012 - when selecting and joining on multiple models, do not create model instances when the foreign key is NULL.
- #1017 - do not coerce the return value of function calls to
COUNT
orSUM
, since the python driver will already give us the right Python value. - #1018 - use global state to resolve
DeferredRelations
, allowing for a nicer API. Thanks @brenguyen711. - #1022 - attempt to avoid creating invalid Python when using
pwiz
with MySQL database columns containing spaces. Yes, fucking spaces. - #1024 - fix bug in SQLite migrator which had a naive approach to fixing indexes.
- #1025 - explicitly check for
None
when determining if the database has been set onModelOptions
. Thanks @joeyespo.
๐ New stuff
- โ Added
TimestampField
for storing datetimes using integers. Greater than second delay is possible through exponentiation. - โ Added
Database.drop_index()
method. - Added a
max_depth
parameter to themodel_to_dict
function in theplayhouse.shortcuts
extension module. SelectQuery.first()
function accepts a parametern
which applies a limit to the query and returns the first row. Previously the limit was not applied out of consideration for subsequent iterations, but I believe usage has shown that a limit is more desirable than reserving the option to iterate without a second query. The old behavior is preserved in the newSelectQuery.peek()
method.group_by()
,order_by()
,window()
now accept a keyward argumentextend
, which, when set toTrue
, will append to the existing values rather than overwriting them.- ๐ Query results support negative indexing.
- C sources are included now as part of the package. I think they should be able to compile for python 2 or 3, on linux or windows...but not positive.
- #895 - added the ability to query using the
<foreign_key>_id
attribute. - ๐ #948 - added documentation about SQLite limits and how they affect
- #1009 - allow
DATABASE_URL
as a recognized parameter to the Flask config.insert_many
.
-
v2.8.1 Changes
๐ This release is long overdue so apologies if you've been waiting on it and ๐ running off master. There are numerous bugfixes contained in this release, so I'll list those first this time.
๐ Bugs fixed
- โ #821 - issue warning if Cython is old
- ๐ #822 - better handling of MySQL connections point for advanced use-cases.
- ๐ #313 - support equality/inequality with generic foreign key queries, and
ensure
get_or_create
works with GFKs. - ๐ #834 - fixed Python3 incompatibilities in the
PasswordField
, thanks @mosquito. - #836 - fix handling of
last_insert_id()
when usingAPSWDatabase
. - #845 - add connection hooks to
APSWDatabase
. - #852 - check SQLite library version to avoid calls to missing APIs.
- #857 - allow database definition to be deferred when using the connection pool.
- #878 - formerly
.limit(0)
had no effect. Now addsLIMIT 0
. - #879 - implement a
__hash__
method forModel
- #886 - fix
count()
for compound select queries. - #895 - allow writing to the
foreign_key_id
descriptor to set the foreign key value. - #893 - fix boolean logic bug in
model_to_dict()
. - #904 - fix side-effect in
clean_prefetch_query
, thanks to @p.kamayev - ๐ฆ #907 - package includes
pskel
now. - #852 - fix sqlite version check in BerkeleyDB backend.
- #919 - add runtime check for
sqlite3
library to match MySQL and Postgres. Thanks @M157q
๐ New features
- โ Added a number of SQLite user-defined functions and โ aggregates.
- ๐ Use the DB-API2
Binary
type forBlobField
. - Implemented the lucene scoring algorithm in the
sqlite_ext
Cython library. - #825 - allow a custom base class for
ModelOptions
, providing an extension - ๐ #830 - added
SmallIntegerField
type. - #838 - allow using a custom descriptor class with
ManyToManyField
. - ๐ #855 - merged change from @lez which included docs on using peewee with Pyramid.
- #858 - allow arguments to be passed on query-string when using the
db_url
module. Thanks @RealSalmon - ๐ #862 - add support for
truncate table
, thanks @dev-zero for the sample code. - ๐ Allow the
related_name
modelMeta
option to be a callable that accepts the foreign key field instance.
-
v2.8.0 Changes
๐ This release includes a couple new field types and greatly improved C extension support for both speedups and SQLite enhancements. Also includes some work, suggested by @foxx, to remove some places where
Proxy
was used in favor of more obvious APIs.๐ New features
- ๐ travis-ci builds now include MySQL and Python 3.5. Dropped support for Python 3.2 and 3.3. Builds also will run the C-extension code.
- 0๏ธโฃ C extension speedups now enabled by default, includes faster implementations for
dict
andtuple
QueryResultWrapper
classes, faster date formatting, and a faster field and model sorting. - ๐ C implementations of SQLite functions is now enabled by default. SQLite extension is now compatible with APSW and can be used in standalone form directly from Python. See SqliteExtDatabase for more details.
- ๐ SQLite C extension now supports
murmurhash2
. - ๐
UUIDField
is now supported for SQLite and MySQL, usingtext
andvarchar
respectively, thanks @foxx! - โ Added
BinaryField
, thanks again, @foxx! - โ Added
PickledField
toplayhouse.fields
. ManyToManyField
now accepts a list of primary keys when adding or removing values from the through relationship.- โ Added support for SQLite table-valued functions using the sqlite-vtfunc library.
- ๐ Significantly simplified the build process for compiling the C extensions.
Backwards-incompatible changes
- โ
Instead of using a
Proxy
for defining circular foreign key relationships, you now need to use DeferredRelation. - โ
Instead of using a
Proxy
for defining many-to-many through tables, you now need to use DeferredThroughModel. - SQLite Virtual Models must now use
Meta.extension_module
andMeta.extension_options
to declare extension and any options. For more details, see VirtualModel. - MySQL database will now issue
COMMIT
statements forSELECT
queries. This was not necessary, but added due to an influx of confused users creating GitHub tickets. Hint: learn to user your damn database, it's not magic!
๐ Bugs fixed
๐ Some of these may have been included in a previous release, but since I did not list them I'm listing them here.
- ๐ #766, fixed bug with PasswordField and Python3. Fuck Python 3.
- ๐ #768, fixed SortedFieldList and
remove_field()
. Thanks @klen! - ๐ #771, clarified docs for APSW.
- ๐ #773, added docs for request hooks in Pyramid (who uses Pyramid, by the way?).
- #774, prefetch() only loads first ForeignKeyField for a given relation.
- ๐ #782, fixed typo in docs.
- #791, foreign keys were not correctly handling coercing to the appropriate python value.
- #792, cleaned up some CSV utils code.
- #798, cleaned up iteration protocol in QueryResultWrappers.
- #806, not really a bug, but MySQL users were clowning around and needed help.