Skip to content

Releases: coleifer/peewee

2.5.1

05 Apr 04:14
Compare
Choose a tag to compare

This is a relatively small release with a few important bugfixes.

Bugs fixed

  • #566, fixed a bug regarding parentheses around compound SELECT queries (i.e. UNION, INTERSECT, etc).
  • Fixed unreported bug where table aliases were not generated correctly for compound SELECT queries.
  • #559, add option to preserve original column order with pwiz. Thanks @elgow!
  • Fixed unreported bug where selecting all columns from a ModelAlias does not use the appropriate FieldAlias objects.

New features

  • #561, added an option for bulk insert queries to return the list of auto-generated primary keys. See docs for InsertQuery.return_id_list.
  • #569, added parse function to the playhouse.db_url module. Thanks @stt!
  • Added hacks section to the docs. Please contribute your hacks!

Backwards-incompatible changes

  • Calls to Node.in_() and Node.not_in() do not take *args anymore and instead take a single argument.

View commits

2.5.0

05 Apr 04:02
Compare
Choose a tag to compare

There are a couple new features so I thought I'd bump to 2.5.x. One change Postgres users may be happy to see is the use of INSERT ... RETURNING to perform inserts. This should definitely speed up inserts for Postgres, since an extra query is no longer needed to get the new auto-generated primary key.

I also added a new context manager/decorator that allows you to use a different database for the duration of the wrapped block.

Bugs fixed

  • #534, CSV utils was erroneously stripping the primary key from CSV data.
  • #537, fix upserts when using insert_many.
  • #541, respect autorollback with PostgresqlExtDatabase. Thanks @davidmcclure.
  • #551, fix for QueryResultWrapper's implementation of the iterator protocol.
  • #554, allow SQLite journal_mode to be set at run-time.
  • Fixed case-sensitivity issue with DataSet.

New features

  • Added support for CAST expressions.
  • Added a hook for extending Node with custom methods.
  • JOIN_<type> became JOIN.<type>, e.g. .join(JOIN.LEFT_OUTER).
  • OP_<code> became OP.<code>.
  • #556, allowed using + and - prefixes to indicate ascending/descending ordering.
  • #550, added Database.initialize_connection() hook.
  • #549, bind selected columns to a particular model. Thanks @jhorman, nice PR!
  • #531, support for swapping databases at run-time via Using.
  • #530, support for SQLCipher and Python3.
  • New RowIDField for sqlite_ext playhouse module. This field can be used to interact with SQLite rowid fields.
  • Added LateralJoin helper to the postgres_ext playhouse module.
  • New example blog app.

View commits

2.4.7

04 Feb 23:37
Compare
Choose a tag to compare

Bugs fixed

  • #504, Docs updates.
  • #506, Fixed regression in aggregate_rows()
  • #510, Fixes bug in pwiz overwriting columns.
  • #514, Correctly cast foreign keys in prefetch().
  • #515, Simplifies queries issued when doing recursive deletes.
  • #516, Fix cloning of Field objects.
  • #519, Aggregate rows now correctly preserves ordering of joined instances.
  • Unreported, fixed bug to not leave expired connections sitting around in the pool.

New features

  • Added support for Postgresql's jsonb type with BinaryJSONField.
  • Add some basic Flask helpers.
  • Add support for UNION ALL queries in #512
  • Add SqlCipherExtDatabase, which combines the sqlcipher database with the sqlite extensions.
  • Add option to print metadata when generating code with pwiz.

View commits

2.4.6

22 Jan 02:10
Compare
Choose a tag to compare

This is a relatively small release with mostly bug fixes and updates to the documentation. The one new feature I'd like to highlight is the ManyToManyField (docs).

Bugs fixed

  • #503, fixes behavior of aggregate_rows() when used with a CompositeKey.
  • #498, fixes value coercion for field aliases.
  • #492, fixes bug with pwiz and composite primary keys.
  • #486, correctly handle schemas with reflection module.

New features

  • Peewee has a new ManyToManyField available in the playhouse.shortcuts module.
  • Peewee now has proper support for NOT IN queries through the Node.not_in() method.
  • Models now support iteration. This is equivalent to Model.select().

View commits

2.4.5

22 Dec 06:12
Compare
Choose a tag to compare

I'm excited about this release, as in addition to a number of new features and bugfixes, it also is a step towards cleaner code. I refactored the tests into a number of modules, using a standard set of base test-cases and helpers. I also introduced the mock library into the test suite and plan to use it for cleaner tests going forward. There's a lot of work to do to continue cleaning up the tests, but I'm feeling good about the changes. Curiously, the test suite runs faster now.

Bugs fixed

  • #471, #482 and #484, all of which had to do with how joins were handled by the aggregate_rows() query result wrapper.
  • #472 removed some needless special-casing in Model.save().
  • #466 fixed case-sensitive issues with the SQLite migrator.
  • #474 fixed a handful of bugs that cropped up migrating foreign keys with SQLite.
  • #475 fixed the behavior of the SQLite migrator regarding auto-generated indexes.
  • #479 fixed a bug in the code that stripped extra parentheses in the SQL generator.
  • Fixed a handful of bugs in the APSW extension.

New features

  • Added connection abstraction called ExecutionContext (see docs).
  • Made all context managers work as decorators (atomic, transaction, savepoint, execution_context).
  • Added explicit methods for IS NULL and IS NOT NULL queries. The latter was actually necessary since the behavior is different from NOT IS NULL (...).
  • Allow disabling backref validation (#465)
  • Made quite a few improvements to the documentation, particularly sections on transactions.
  • Added caching to the DataSet extension, which should improve performance.
  • Made the SQLite migrator smarter with regards to preserving indexes when a table copy is necessary.

View commits

2.4.4

03 Dec 03:29
Compare
Choose a tag to compare

Biggest news: peewee has a new logo!

Backwards-incompatible changes

  • The argument signature for the SqliteExtDatabase.aggregate() decorator changed so that the aggregate name is the first parameter, and the number of parameters is the second parameter. If no values are specified, peewee will choose the name of the class and an un-specified number of arguments (-1).
  • The logic for saving a model with a composite key changed slightly. Previously, if a model had a composite primary key and you called save(), only the dirty fields would be saved.

Bugs fixed

  • #462
  • #465, add hook for disabling backref validation.
  • #466, fix case-sensitive table names with migration module.
  • #469, save only dirty fields.

New features

  • Lots of enhancements and cleanup to the playhouse.apsw_ext module.
  • The playhouse.reflection module now supports introspecting indexes.
  • Added a model option for disabling backref validation.
  • Added support for the SQLite closure table extension.
  • Added support for virtual fields, which act on dynamically-created virtual table fields.
  • Added a new example: a virtual table implementation that exposes Redis as a relational database table.
  • Added a module playhouse.sqlite_aggregates that contains a handful of aggregates you may find useful when developing with SQLite.
  • Small documentation updates here and there.

View commits

2.4.3

22 Nov 18:58
Compare
Choose a tag to compare

This release contains numerous improvements, particularly around the built-in database introspection utilities. Peewee should now also be compatible with PyPy.

Bugs fixed

  • #466, table names are case sensitive in the SQLite migrations module.
  • #465, added option to disable backref validation.
  • #462, use the schema name consistently with postgres reflection.

New features

  • New model Meta option to disable backref validation. See validate_backrefs.
  • Added documentation on ordering by calculated values.
  • Added basic PyPy compatibility.
  • Added logic to close cursors after they have been exhausted.
  • Structured and consolidated database metadata introspection, including improvements for introspecting indexes.
  • Added support to prefetch for traversing up the query tree.
  • Added introspection option to skip invalid models while introspecting.
  • Added option to limit the tables introspected.
  • Added closed connection detection to the MySQL connection pool.
  • Enhancements to passing options to creating virtual tables with SQLite.
  • Added factory method for generating Closure tables for use with the transitive_closure SQLite extension.
  • Added support for loading SQLite extensions.
  • Numerous test-suite enhancements and new test-cases.

View commits

2.4.2

09 Nov 19:21
Compare
Choose a tag to compare

This release contains a number of improvements to the reflection and migrate extension modules. I also added an encrypted diary app to the examples directory.

Bugs fixed

  • #449, typo in the db_url extension, thanks to @malea for the fix.
  • #457 and #458, fixed documentation deficiences.

New features

  • Added support for importing data when using the DataSet extension.
  • Added an encrypted diary app to the examples.
  • Better index reconstruction when altering columns on SQLite databases with the migrate module.
  • Support for multi-column primary keys in the reflection module.
  • Close cursors more aggressively when executing SELECT queries.

View commits

2.4.1

28 Oct 16:16
Compare
Choose a tag to compare

This release contains a few small bugfixes.

Bugs fixed

  • #448, add hook to the connection pool for detecting closed connections.
  • #229, fix join attribute detection.
  • #447, fixed documentation typo.

View commits

2.4.0

18 Oct 16:33
Compare
Choose a tag to compare

This release contains a number of enhancements to the playhouse collection of extensions.

Backwards-incompatible changes

As of 2.4.0, most of the introspection logic was moved out of the pwiz module and into playhouse.reflection.

New features

  • Created a new reflection extension for introspecting databases. The reflection module additionally can generate actual peewee Model classes dynamically.
  • Created a dataset library (based on the SQLAlchemy project of the same name). For more info check out the blog post announcing playhouse.dataset.
  • Added a db_url module which creates Database objects from a connection string.
  • Added csv dump functionality to the CSV utils extension.
  • Added an atomic context manager to support nested transactions.
  • Added support for HStore, JSON and TSVector to the reflection module.
  • More documentation updates.

Bugs fixed

  • Fixed #440, which fixes a bug where Model.dirty_fields did not return an empty set for some subclasses of QueryResultWrapper.

View commits