Skip to content

Releases: coleifer/peewee

3.14.5

27 Oct 03:01
Compare
Choose a tag to compare

Note: this release contained a bug and has been removed from PyPI. Use 3.14.6 or newer.

This release contains a number of bug-fixes and small improvements.

  • Only raise DoesNotExist when lazy_load is enabled on ForeignKeyField, fixes issue #2377.
  • Add missing convenience method ModelSelect.get_or_none()
  • Allow ForeignKeyField to specify a custom BackrefAccessorClass, references issue #2391.
  • Ensure foreign-key-specific conversions are applied on INSERT and UPDATE, fixes #2408.
  • Add handling of MySQL error 4031 (inactivity timeout) to the ReconnectMixin helper class. Fixes #2419.
  • Support specification of conflict target for ON CONFLICT/DO NOTHING.
  • Add encoding parameter to the DataSet freeze() and thaw() methods, fixes #2425.
  • Fix bug which prevented DeferredForeignKey from being used as a model's primary key, fixes #2427.
  • Ensure foreign key's related object cache is cleared when the foreign-key is set to None. Fixes #2428.
  • Allow specification of (schema, table) to be used with CREATE TABLE AS..., fixes #2423.
  • Allow reusing open connections with DataSet, refs #2441.
  • Add highlight() and snippet() helpers to Sqlite SearchField, for use with full-text search extension.
  • Preserve user-provided aliases in column names. Fixes #2453.
  • Add support for Sqlite 3.37 strict tables.
  • Ensure database is inherited when using ThreadSafeDatabaseMetadata, and also adds an implementation in playhouse.shortcuts along with basic unit tests.
  • Better handling of Model's dirty fields when saving, fixes #2466.
  • Add basic support for MariaDB connector driver in playhouse.mysql_ext, refs issue #2471.
  • Begin a basic implementation for a psycopg3-compatible pg database, refs issue #2473.
  • Add provisional support for RETURNING when using the appropriate versions of Sqlite or MariaDB.

View commits

3.14.4

19 Mar 15:54
Compare
Choose a tag to compare

This release contains an important fix for a regression introduced by commit ebe3ad5, which affected the way model instances are converted to parameters for use in expressions within a query. The bug could manifest when code uses model instances as parameters in expressions against fields that are not foreign-keys.

The issue is described in #2376.

View commits

3.14.3

11 Mar 15:06
Compare
Choose a tag to compare

This release contains a single fix for ensuring NULL values are inserted when issuing a bulk-insert of heterogeneous dictionaries which may be missing explicit NULL values. Fixes issue #2638.

View commits

3.14.2

04 Mar 15:06
Compare
Choose a tag to compare

This is a small release mainly to get some fixes out.

  • Support for named Check and foreign-key constraints.
  • Better foreign-key introspection for CockroachDB (and Postgres).
  • Register UUID adapter for Postgres.
  • Add fn.array_agg() to blacklist for automatic value coercion.

View commits

3.14.1

07 Feb 22:52
Compare
Choose a tag to compare

This release contains primarily bugfixes.

  • Properly delegate to a foreign-key field's db_value() function when converting model instances. #2304.
  • Strip quote marks and parentheses from column names returned by sqlite cursor when a function-call is projected without an alias. #2305.
  • Fix DataSet.create_index() method, #2319.
  • Fix column-to-model mapping in model-select from subquery with joins, #2320.
  • Improvements to foreign-key lazy-loading thanks @conqp, #2328.
  • Preserve and handle CHECK() constraints in Sqlite migrator, #2343.
  • Add stddev aggregate function to collection of sqlite user-defined funcs.

View commits

3.14.0

07 Nov 18:48
Compare
Choose a tag to compare

This release has been a bit overdue and there are numerous small improvements
and bug-fixes. The bugfix that prompted this release is #2293, which is a
regression in the Django-inspired .filter() APIs that could cause some
filter expressions to be discarded from the generated SQL. Many thanks for the
excellent bug report, Jakub.

  • Add an experimental helper, shortcuts.resolve_multimodel_query(), for resolving multiple models used in a compound select query.
  • Add a lateral() method to select query for use with lateral joins, refs issue #2205.
  • Added support for nested transactions (savepoints) in cockroach-db (requires 20.1 or newer).
  • Automatically escape wildcards passed to string-matching methods, refs #2224.
  • Allow index-type to be specified on MySQL, refs #2242.
  • Added a new API, converter() to be used for specifying a function to use to convert a row-value pulled off the cursor, refs #2248.
  • Add set() and clear() method to the bitfield flag descriptor, refs #2257.
  • Add support for range types with IN and other expressions.
  • Support CTEs bound to compound select queries, refs #2289.

Bug-fixes

  • Fix to return related object id when accessing via the object-id descriptor, when the related object is not populated, refs #2162.
  • Fix to ensure we do not insert a NULL value for a primary key.
  • Fix to conditionally set the field/column on an added column in a migration, refs #2171.
  • Apply field conversion logic to model-class values. Relocates the logic from issue #2131 and fixes #2185.
  • Clone node before modifying it to be flat in an enclosed nodelist expr, fixes issue #2200.
  • Fix an invalid item assignment in nodelist, refs #2220.
  • Fix an incorrect truthiness check used with save() and only=, refs #2269.
  • Fix regression in filter() where using both *args and **kwargs caused the expressions passed as args to be discarded. See #2293.

View commits

3.13.3

24 Apr 00:36
Compare
Choose a tag to compare
  • Allow arbitrary keyword arguments to be passed to DataSet constructor, which are then passed to the instrospector.
  • Allow scalar subqueries to be compared using numeric operands.
  • Fix bulk_create() when model being inserted uses FK identifiers.
  • Fix bulk_update() so that PK values are properly coerced to the right data-type (e.g. UUIDs to strings for Sqlite).
  • Allow array indices to be used as dict keys, e.g. for the purposes of updating a single array index value.

View commits

3.13.2

27 Mar 16:52
Compare
Choose a tag to compare
  • Allow aggregate functions to support an ORDER BY clause, via the addition of an order_by() method to the function (fn) instance. Refs #2094.
  • Fix prefetch() bug, where related "backref" instances were marked as dirty, even though they had no changes. Fixes #2091.
  • Support LIMIT 0. Previously a limit of 0 would be translated into effectively an unlimited query on MySQL. References #2084.
  • Support indexing into arrays using expressions with Postgres array fields. References #2085.
  • Ensure postgres introspection methods return the columns for multi-column indexes in the correct order. Fixes #2104.
  • Add support for arrays of UUIDs to postgres introspection.
  • Fix introspection of columns w/capitalized table names in postgres (#2110).
  • Fix to ensure correct exception is raised in SqliteQueueDatabase when iterating over cursor/result-set.
  • Fix bug comparing subquery against a scalar value. Fixes #2118.
  • Fix issue resolving composite primary-keys that include foreign-keys when building the model-graph. Fixes #2115.
  • Allow model-classes to be passed as arguments, e.g., to a table function. Refs #2131.
  • Ensure postgres JSONField.concat() accepts expressions as arguments.

View commits

3.13.1

06 Dec 15:44
Compare
Choose a tag to compare

Fix a regression when specifying keyword arguments to the atomic() or
transaction() helper methods. Note: this only occurs if you were using Sqlite
and were explicitly setting the lock_type= parameter.

View commits

3.13.0

06 Dec 01:34
Compare
Choose a tag to compare

CockroachDB support added

This will be a notable release as it adds support for
CockroachDB, a distributed, horizontally-scalable
SQL database.

Other features and fixes

  • Allow FOR UPDATE clause to specify one or more tables (FOR UPDATE OF...).
  • Support for Postgres LATERAL join.
  • Properly wrap exceptions raised during explicit commit/rollback in the appropriate peewee-specific exception class.
  • Capture original exception object and expose it as exc.orig on the wrapped exception.
  • Properly introspect SMALLINT columns in Postgres schema reflection.
  • More flexible handling of passing database-specific arguments to atomic() and transaction() context-manager/decorator.
  • Fix non-deterministic join ordering issue when using the filter() API across several tables (#2063).

View commits