Skip to content

Releases: coleifer/peewee

2.10.0

08 May 21:11
Compare
Choose a tag to compare

The main change in this release is the removal of the AESEncryptedField,
which was included as part of the playhouse.fields extension. It was brought
to my attention that there was some serious potential for security
vulnerabilities. Rather than give users a false sense of security, I've decided
the best course of action is to remove the field.

  • Remove the playhouse.fields.AESEncryptedField over security concerns
    described in ticket #1264.
  • Correctly resolve explicit table dependencies when creating tables, refs
    #1076. Thanks @maaaks.
  • Implement not equals comparison for CompositeKey.

View commits

2.9.2

20 Apr 00:37
Compare
Choose a tag to compare
  • Fixed significant bug in the savepoint commit/rollback implementation. Many
    thanks to @Syeberman for raising the issue. See #1225 for details.
  • Added support for postgresql INTERVAL columns. The new IntervalField in
    the postgres_ext module is suitable for storing datetime.timedelta.
  • Fixed bug where missing sqlite3 library was causing other, unrelated
    libraries to throw errors when attempting to import.
  • Added a case_sensitive parameter to the SQLite REGEXP function
    implementation. The default is False, to preserve backwards-compatibility.
  • Fixed bug that caused tables not to be created when using the dataset
    extension. See #1213 for details.
  • Modified drop_table to raise an exception if the user attempts to drop
    tables with CASCADE when the database backend does not support it.
  • Fixed Python3 issue in the AESEncryptedField.
  • Modified the behavior of string-typed fields to treat the addition operator
    as concatenation. See #1241 for details.

View commits

2.9.1

20 Apr 00:37
Compare
Choose a tag to compare
  • Fixed #1218, where the use of playhouse.flask_utils was requiring the
    sqlite3 module to be installed.
  • Fixed #1219 regarding the SQL generation for composite key sub-selects,
    joins, etc.

View commits

2.9.0

20 Apr 00:37
Compare
Choose a tag to compare

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.

View commits

2.8.8

20 Apr 00:36
Compare
Choose a tag to compare

This release contains a single important bugfix for a regression in specifying
the type of lock to use when opening a SQLite transaction.

View commits

2.8.7

20 Apr 00:36
Compare
Choose a tag to compare

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 into bin 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 common PRAGMA
    settings. For example, to set the cache size to 4MB, db.cache_size = 1000.
  • Clarified documentation on calling commit() or rollback() 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 in peewee.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 or FOR 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 calls connect()
    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 the connect() call to get_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.).

View commits

2.8.5

20 Apr 00:35
Compare
Choose a tag to compare

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 the GROUP BY and HAVING clauses of sub-queries.

View commits

2.8.4

20 Apr 00:35
Compare
Choose a tag to compare

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 the speedups module. The code
is much easier to read than before.

View commits

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.

View commits

2.8.3

20 Apr 00:35
Compare
Choose a tag to compare

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 accept on and join_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 their dirty flag incorrectly set.
  • #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 a ForeignKeyField for the name of the
    ObjectIdDescriptor, except when the db_column and field name are the
    same, in which case the ID descriptor will be named <field_name>_id.

View commits

2.8.2

09 Aug 05:35
Compare
Choose a tag to compare

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
  • #895 - added the ability to query using the <foreign_key>_id attribute.
  • #922 - ensure that peewee.OperationalError is raised consistently when
    using the RetryOperationalError mixin.
  • #929 - ensure that pwiz will import the appropriate extensions when
    vendor-specific fields are used.
  • #930 - ensure that pwiz-generated models containing UnknownField
    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 database Proxy.
  • #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.
  • #948 - added documentation about SQLite limits and how they affect
    insert_many.
  • #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 automatic rowid (and
    docid) 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 of IN exprs.
  • #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 in djpeewee
  • #995 - fix the behavior of truncate_date with Postgresql. Thanks @Zverik.
  • #1009 - allow DATABASE_URL as a recognized parameter to the Flask config.
  • #1011 - correctly handle bytes wrapper used by PasswordField to bytes.
  • #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 or SUM,
    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 on ModelOptions. 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 the model_to_dict function in
    the playhouse.shortcuts extension module.
  • SelectQuery.first() function accepts a parameter n 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 new
    SelectQuery.peek() method.
  • group_by(), order_by(), window() now accept a keyward argument
    extend, which, when set to True, 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.

View commits