github coleifer/peewee 4.2.0

latest release: 4.2.1
5 hours ago
  • Add django-style filter lookups: contains, startswith, endswith, between, is_null, not_in and iregexp.
  • Fix SQLite index value inlining to apply properly.
  • Fix PostgresqlDatabase(isolation_level=...) having no effect on transactions. Previously only atomic(isolation_level=...) worked.
  • Fix Ordering.collate() dropping the nulls= ordering.
  • Fix double-escaping of backticks in MySQL get_indexes().
  • Honor the windows= parameter of the Select constructor.
  • Remove vestigial Python 2 compat (reraise(), __div__, __nonzero__) and assorted dead internal code.
  • Remove TimestampField.local_to_utc() and TimestampField.utc_to_local().
  • Select.columns() no longer accepts and ignores keyword arguments.
  • Remove unused Metadata.get_rel_for_model().
  • Fix SelectBase.exists() ignoring its database argument.
  • Fix CursorWrapper indexing: cursor[n] raised IndexError for uncached rows and cursor[0] fetched the entire result set.
  • Fix .namedtuples() crashing on selected columns that are not valid Python identifiers.
  • Preserve materialized= when compounding CTEs via union()/union_all().
  • Fix ManyToManyField reads when the through-model foreign keys use the '!' backref sentinel.
  • Fix connection pooling with the mariadb connector - pooled connections were discarded on every checkout.
  • Fix sqliteq stop() to drain the write queue and return True.
  • Fix apsw aggregate registration binding every name to the last-registered aggregate class.
  • Fix two NameErrors in cysqlite_ext: blob_open() and progress().
  • Fix pwiz emitting an invalid attr= keyword instead of on_delete/on_update for reflected foreign keys.
  • Fix dataset infinite loop on self-referential foreign keys, crash on headerless CSV import, thaw() validating against export rather than import formats, and the importer mutating live model metadata.
  • Fix model_to_dict to honor only=/exclude= for many-to-many fields, fix resolve_multimodel_query on queries with narrowed selections.
  • Fix signals.Model.save(True) reporting created=False when force_insert is passed positionally.
  • Fix CompressedField crashing on str values.
  • Fix psycopg3 server-side cursors (missing withhold) and CockroachDB run_transaction retry detection under psycopg3.
  • Async queries are now logged to the peewee logger.
  • Remove dead code and unused imports throughout playhouse; remove the broken, unused get_current_url/get_next_url helpers from flask_utils.
  • Fix delete_instance(recursive=True) failing to cascade to the children of a model reachable through both nullable and non-nullable foreign-keys.
  • Fix subqueries losing their parentheses when used as a CASE value inside a single-argument function call, e.g. fn.SUM(Case(...)).
  • Fix plain-Table inserts on returning-clause databases binding the primary-key name as a parameter and returning None instead of the new id.
  • CompositeKey comparisons raise ValueError when the value's length does not match the key, rather than silently matching on a prefix.
  • Async: connection-acquisition errors are translated to peewee exception types, matching query execution.
  • Fix FieldAlias.model to reference the model alias rather than the aliased model; alias-rooted join queries no longer construct and discard a spurious instance of the aliased model for every result row.
  • Fix playhouse.postgres_ext.JSONField creating jsonb columns after the core postgres backend began mapping the JSON field-type to JSONB; its DDL is json again, and json-vs-jsonb function selection for chained lookups now follows the field's declared datatype.
  • Unaliased expressions in join queries now hydrate using the same cleaned attribute name as flat queries (e.g. COUNT rather than COUNT(1).
  • Field.__hash__ is keyed on the model's schema and table-name rather than its class name, so same-named model classes (factories, separate modules, schema-per-tenant layouts) no longer collide in field-keyed registries such as backrefs; redefining or re-importing a model in place still replaces its entries.
  • Fix UnboundLocalError when joining from a model-less source to a model, e.g. join_from(cte, SomeModel, on=...); the joined instance is stored in the source's row dict, keyed by the model name.
  • BlobField, CompressedField and the sqlite_udf.gzip() function encode str values using utf-8 instead of raw_unicode_escape. Behavior change for non-ASCII strings: characters above the latin-1 range are no longer mangled into literal escape sequences, but blobs written from non-ASCII strings by earlier versions will not compare equal to newly-written ones.

Massive bug hunt and patch release. Should be all set, going to let these fixes simmer for a bit.

View commits

im-1783889805-310

Don't miss a new peewee release

NewReleases is sending notifications on new releases.