Update dependency peewee to v4 - #368
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
from
March 1, 2026 22:07
f79cc78 to
11f7ea9
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
3 times, most recently
from
March 16, 2026 12:53
e732937 to
f2b2fb3
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
2 times, most recently
from
March 27, 2026 01:03
2d42a13 to
909f7b7
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
3 times, most recently
from
April 6, 2026 17:55
ef0fad9 to
de717f6
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
3 times, most recently
from
April 23, 2026 22:29
c9ba699 to
bd6f7cb
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
2 times, most recently
from
May 20, 2026 14:37
ca7a53e to
a774d37
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
from
May 24, 2026 17:17
a774d37 to
43e29c7
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
from
June 4, 2026 05:07
43e29c7 to
a3bd430
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
4 times, most recently
from
June 16, 2026 19:13
7bce7a9 to
1d7e6f8
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
2 times, most recently
from
July 4, 2026 13:36
ac149f5 to
24214d3
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
5 times, most recently
from
July 14, 2026 19:35
dc7dd08 to
d0c4b00
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
3 times, most recently
from
July 17, 2026 21:09
a594fd5 to
b3a14fb
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
2 times, most recently
from
July 31, 2026 20:55
8d2ac6e to
c1e9f42
Compare
renovate
Bot
force-pushed
the
renovate/peewee-4.x
branch
from
August 12, 2026 01:17
c1e9f42 to
00ff250
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
~3.19.0→~4.3.0Release Notes
coleifer/peewee (peewee)
v4.3.0Compare Source
Backwards-incompatible:
requires-python >= 3.8. I've been putting off committing toanything like this, since technically we still work on 3.7, but 3.8 is the
minimum we run on CI so it felt correct.
docidimplicit primary key on legacyFTSModel(FTS4) withrowid, which is equivalent. Usingdocidpresents no benefit andswitching to
rowidmakes operations more consistent. Users have a coupleoptions when updating:
docid = DocIDField()to your FTSModel classes.docidwithrowid. The underlying datadoes not require a migration, as docid was just an alias for rowid.
conflict was ignored,
execute()returnsNoneon every backend.Improvements:
SELECT 1and discards deadones, matching the MySQL pool's ping. Previously a connection terminated
server-side while parked in the pool was handed out and failed on first use.
close_pool()in pwasyncio no longer spins the event loop on Python3.13+ attempting to reclaim connections in use, and pool creation is now
bounded by
acquire_timeout. Connections terminated during shutdown aredetected as stale and discarded at the next checkout.
JSONFieldnegative path indexes render as$[last]/$[last-n]onMySQL/MariaDB. Previously the sqlite-only
$[#-n]form was emitted, whichMariaDB evaluates to NULL (overwriting the column when used with
set())and MySQL rejects as an invalid path.
JSONFieldmutators (set(),insert(), etc) store Python booleans asjson true/false instead of the driver's 0/1, so values written by
create()and by mutators compare consistently. Floats on MySQL/MariaDB likewise take
their json text form, as MariaDB reformats driver floats in a way that
breaks equality against the stored document.
JSONFieldinstead ofemitting
from playhouse.mysql_ext import *for a re-exported field.playhouse.pwasynciologs to thepeewee.pwasynciologger rather thanplayhouse.pwasyncio.datasetfreeze/thaw of NULL blob and datetime values. Empty CSV cellsnow import as NULL for non-text fields.
on=predicate instead of silentlyreplacing it with
true, and default toON truewhenon=is omitted.contentoption must be a Model or table-name string.Passing a Field now raises
ImproperlyConfigured: it generated DDL thatfts5 rejects outright and that fts4 silently truncated to the table name.
FTS5Model.VocabModel(): term/col/offset were declared as virtualfields and omitted from default SELECTs, the instance-type model had the
wrong column set, all three table-types shared one default table name, and
the generated class was cached with whatever database was bound at first
call. Vocab models are now built fresh per call with real fields, correct
columns and per-type default names.
FTS5Model.web_query(), which translates the query syntax users expectfrom a search box (quoted phrases, AND/OR/NOT,
-exclusion,column:filters and parentheses) into an FTS5 query. Anything else is searched as
text, so
covid-19orc++need no escaping, and the translation is alwaysa valid query. The parser lives in the new
playhouse.fts_parsermodule.Use it with search:
Doc.search(Doc.web_query(user_input)).FTS5Model.delete_command(), which removes a row using the fts5deletecommand. This is how rows are removed from external-content and contentless
tables, which need the originally-indexed values supplied back to them:
sqlite treats an omitted column as NULL, and values that do not match what
was indexed leave stale entries behind (undetectably so on a contentless
table). Peewee therefore requires a value for every indexed column; pass
Nonewhere NULL was indexed. The command exists only for those twoconfigurations - default-storage and
contentless_delete=1tables rejectit and use ordinary
DELETE.as_rowcount()is specified, along withproper return of all parts of a composite PK instead of just the 1st column.
last_insert_id()is implemented once onDatabase, with backendsoverriding
_last_insert_rowid()where the driver differs. APSW and theMariaDB connector inherit composite primary-key support as a result, having
previously returned only the first column.
View commits
v4.2.6Compare Source
written through the foreign-key descriptor. The fk id on the source
instance keeps the column's value (previously it was overwritten with
None), and accessing the attribute on a non-null fk returnsNoneinstead of raising
DoesNotExist.View commits
v4.2.5Compare Source
id()-based hash afterclone().View commits
v4.2.4Compare Source
Model.select()used as a FROM/JOIN source reduced to its pk.fn.EXISTS(compound)double-parenthesizing.x.in_(ValuesList(...))dropping parens aroundVALUES..join(on=...)mis-attaching rows when the fk is on the rhs.ON CONFLICT ... DO NOTHINGdropping the target/where/constraint.View commits
v4.2.3Compare Source
UNION/INTERSECT/EXCEPT) used as a correlatedsubquery emitting a phantom alias for the correlated outer table in every
branch but the left-most, producing invalid SQL (e.g.
no such column: t4.id). The right-hand branch renders in a fresh alias scope that no longerresolved the outer source's existing alias, it now inherits the enclosing
scope's aliases while still assigning fresh aliases to its own sources.
weightspassed as adictbeing mis-applied to thewrong columns. For FTS3/4 the implicit
docidprimary-key was included whenbuilding the weight list, shifting every column by one (raising
IndexErrorwith the Python ranking UDF, silently mis-scoring with the Cython one), for
FTS5,
UNINDEXEDcolumns were skipped even thoughbm25()weights arepositional across all columns. The list form of
weightswas unaffected..cte()clearing the source query's CTE list in place: converting a querythat carried a
with_cte(...)clause into a CTE stripped the clause from thatquery, so reusing it afterward referenced an undeclared CTE. The query is now
cloned before its CTE list is reset.
Table.select()with no arguments on aTabledeclared without columnsemitting an empty projection (
SELECT FROM ...) instead ofSELECT *.Table.insert(select_query)with nocolumnsraisingTypeErrorinsteadof rendering
INSERT INTO t SELECT ....ON DELETE/ON UPDATEactionwhen
add_not_null()orrename_column()rebuilds the constraint, silentlydowngrading e.g.
CASCADEtoRESTRICT. The actions reported byget_foreign_keys()are now carried through to the rebuilt constraint.postgres_extJSONcontains/contained_by/concatraisingAttributeError, andremove()silently rewriting the entire column, whenapplied to a
.path()-chained lookup (e.g.Model.data['a'].path('b')). Allfour now resolve the root field and full path via
_resolve_root(), matchingthe sibling
set/replace/insert/append/updatemutators.postgres_ext.JSONFielddocs: thejson-column field does notsupport the
jsonb-based mutation/concatenation builders (they raiseProgrammingError), so the misleading "Postgres casts implicitly" claim wasremoved and new code is steered to the built-in
JSONField.UNIQUE (a, b)constraintas a column when rebuilding a table (
add_not_null,drop_column, ...),raising
no column named UNIQUE;uniqueis now recognized as a constraint.CREATE TABLEkeywordsfor a table whose name is a case-insensitive substring of them (e.g.
ab,t,tab) -- the table-name substitution is now anchored to the trailingname token.
View commits
v4.2.2Compare Source
Field.__hash__again... fml. Use(model_cls, field name).Metadata.remove_ref()removing the wrong foreign-key when a modelhas multiple foreign-keys to the same target, as
list.remove()matchedthe first entry via the overloaded
Field.__eq__.CaseorCastcollapsingto its alias in an
UPDATE ... SETvalue and inON CONFLICT DO UPDATE,as
qualify_names()wrapped the value atSCOPE_COLUMN.namedtuples()on a query-builder (Table) query raisingValueErrorwhen a column name is not a valid identifier. The plain
NamedTupleCursorWrappernow passesrename=True, matching the model path.object as
None, so accessing the attribute raisedAttributeError. Theouter-join test had regressed to
endswith('OUTER')(never true). It nowalso recognizes
FULL JOINandLEFT JOIN LATERAL.ModelSelect.select_extend()mutating its receiver's default-projectionflag, so a base
Model.select()reused as a subquery stopped collapsing toits primary key. It now flags the returned clone, matching
select().distinct(True)anddistinct(False)not clearing a priordistinct(*columns), so the query kept renderingDISTINCT ON (...)insteadof a plain
DISTINCTor no distinct at all.get_indexes()shredding an expression index whose key containsa comma, e.g.
COALESCE(a, 0)split into two bogus columns. It joined theper-key definitions into a comma-delimited string and split on the comma. It
now reads the key array directly.
Model.insert(),insert({})) emittingDEFAULT VALUESand dropping python-side field defaults, inconsistent with a partial insert
which backfills them. A model with no python defaults still uses
DEFAULT VALUES.View commits
v4.2.1Compare Source
Can't ship a stub that's not complete. Missed moving server_side_cursor()
helper into the core psycopg helper.
View commits
v4.2.0Compare Source
contains,startswith,endswith,between,is_null,not_inandiregexp.PostgresqlDatabase(isolation_level=...)having no effect ontransactions. Previously only
atomic(isolation_level=...)worked.Ordering.collate()dropping thenulls=ordering.get_indexes().windows=parameter of theSelectconstructor.reraise(),__div__,__nonzero__)and assorted dead internal code.
TimestampField.local_to_utc()andTimestampField.utc_to_local().Select.columns()no longer accepts and ignores keyword arguments.Metadata.get_rel_for_model().SelectBase.exists()ignoring itsdatabaseargument.CursorWrapperindexing:cursor[n]raised IndexError for uncachedrows and
cursor[0]fetched the entire result set..namedtuples()crashing on selected columns that are not validPython identifiers.
materialized=when compounding CTEs viaunion()/union_all().ManyToManyFieldreads when the through-model foreign keys use the'!'backref sentinel.mariadbconnector - pooled connectionswere discarded on every checkout.
sqliteqstop()to drain the write queue and return True.aggregate class.
NameErrors incysqlite_ext:blob_open()andprogress().attr=keyword instead ofon_delete/on_updatefor reflected foreign keys.datasetinfinite loop on self-referential foreign keys, crash onheaderless CSV import,
thaw()validating against export rather thanimport formats, and the importer mutating live model metadata.
model_to_dictto honoronly=/exclude=for many-to-many fields,fix
resolve_multimodel_queryon queries with narrowed selections.signals.Model.save(True)reportingcreated=Falsewhenforce_insertis passed positionally.CompressedFieldcrashing onstrvalues.withhold) and CockroachDBrun_transactionretry detection under psycopg3.peeweelogger.playhouse, remove thebroken, unused
get_current_url/get_next_urlhelpers fromflask_utils.delete_instance(recursive=True)failing to cascade to the childrenof a model reachable through both nullable and non-nullable foreign-keys.
a single-argument function call, e.g.
fn.SUM(Case(...)).Tableinserts on returning-clause databases binding theprimary-key name as a parameter and returning None instead of the new id.
CompositeKeycomparisons raiseValueErrorwhen the value's length doesnot match the key, rather than silently matching on a prefix.
types, matching query execution.
FieldAlias.modelto reference the model alias rather than the aliasedmodel, alias-rooted join queries no longer construct and discard a spurious
instance of the aliased model for every result row.
playhouse.postgres_ext.JSONFieldcreatingjsonbcolumns after thecore postgres backend began mapping the JSON field-type to JSONB, its DDL
is
jsonagain, and json-vs-jsonb function selection for chained lookupsnow follows the field's declared datatype.
attribute name as flat queries (e.g.
COUNTrather thanCOUNT(1).Field.__hash__is keyed on the model's schema and table-name rather thanits 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.
UnboundLocalErrorwhen joining from a model-less source to a model,e.g.
join_from(cte, SomeModel, on=...), the joined instance is stored inthe source's row dict, keyed by the model name.
BlobField,CompressedFieldand thesqlite_udf.gzip()function encodestrvalues using utf-8 instead ofraw_unicode_escape. Behavior changefor 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.
View commits
v4.1.2Compare Source
for reporting and the initial patch.
has_key,has_keys,has_any_keys) to thecore
JSONFieldon SQLite, implemented withjson_type().contains,contained_by) to the coreJSONFieldon SQLite via a registered_pw_json_containsUDF that emulatesPostgres'
@>semantics (structural, level-aligned). The coreJSONFieldnow has full predicate parity across SQLite, Postgres, and MySQL/MariaDB.
View commits
v4.1.1Compare Source
Load()). Seedocumentation.
This replaces
prefetch(), is more flexible and also supports options forapplying a row limit to sub-results, and a strategy that materializes the ID
list (in addition to SELECT IN and JOIN strategies).
MySQLJSONField(playhouse.mysql_ext) withcontains_any()for theJSON_OVERLAPS/"match any" counterpart tocontainsfor JSON arrays.lazy_load=Falsewhen serializingrecursively with
model_to_dict(), #3055.View commits
v4.1.0Compare Source
generated before a conn was opened. We were trying to do some introspection
on the server version, but I've decided instead to make
mariadb=be adatabase param, per @alisonatwork's suggestion, with the default being
"MySQL" flavored JSON. Refs #3053
JSONFieldcontainment (contains,contained_by) no longer wraps itsargument in
CAST/JSON_COMPACTon MySQL/MariaDB, #3053.View commits
v4.0.9Compare Source
View commits
v4.0.8Compare Source
BaseQuery.aexecute()- an async twin ofexecute()available on allquery types, executing through the query's bound async database:
await User.select().aexecute(),await user.tweets.aexecute(). Returnsexactly what
execute()returns, including result rows for DML withRETURNING. Queries remain non-awaitable; this is an ordinary coroutinemethod and the only async method on queries.
playhouse.pwasynciousing "a"-prefixed coroutinecounterparts of the row-level
Modelmethods (acreate,aget,aget_or_none,aget_by_id,aget_or_create,aset_by_id,adelete_by_id,abulk_create,abulk_update,asave,adelete_instance), available via the newAsyncModel/AsyncModelMixinclasses. Each is a thin delegation through the greenletbridge, so behavior is identical to the synchronous implementation.
Note: the
Modelproperty of async databases now returns a base classthat includes these methods - relevant only if you introspect the base
class of
db.Modelsubclasses.afetch()for explicit, awaitable lazy foreign-key resolution:user = await tweet.afetch(Tweet.user). Already-loaded relations (viajoin or prefetch) return immediately without a query.
db.first(query, n=1)async helper.MissingGreenletBridgeerrors now include a hint describing the asyncAPIs to use.
APIs documented in the docs
are stable. The asyncio stress test now also runs in CI.
View commits
v4.0.7Compare Source
playhouse.pwasyncio: report correct UPDATE / DELETE rowcounts onasyncpg, roll back open transactions when connections are returned to the
pool, raise instead of deadlocking when querying during
iterate(), anddetect the MySQL / MariaDB server version.
playhouse.pwasynciofixes: a seconditerate()on a busyconnection raises instead of deadlocking, asyncpg exceptions are translated
to peewee exception types, registered aggregates / collations / window
functions / extensions and
timeoutare applied to async SQLiteconnections,
:memory:databases use a single connection,atomic()accepts transaction arguments (e.g.
lock_type), postgres connection URLsand
isolation_levelare supported,%%in raw SQL is unescaped, andattempting a query outside the greenlet bridge no longer emits "never
awaited" warnings.
playhouse.pydantic_utils: JSON fields validate asAny(nowincluding the sqlite_ext
JSONField), foreign keys may be included /excluded by field name or column name, server-side defaults like
SQL('CURRENT_TIMESTAMP')are no longer emitted as schema defaults, andrelationshipskeys are validated.JSONFieldto core that provides basic operationsand also more consistent behavior when reading data. By default the new core
JSONField treats extracted values as JSON, which is generally the correct
thing, but "text-mode" is available as a chained
.as_text()method. Seedocs.
May eventually replace the backend-specific implementations with subclasses
that inherit semantics of this new field.
Note:
playhouse.mysql_ext.JSONFieldis now the core field. The oldjson_dumps/json_loadsarguments are renameddumps/loads, theextract()method is removed (use item-access orpath()), and MySQLtables are now created with
JSONcolumns rather thanTEXT.to @abulgher, #3050.
fromisoformat()ended up causing previously-unconverted strings (Ymd)to be converted in some cases, e.g. formatting a datetime as a str (#3051).
The change I made to address this is to make explicit casts on function calls
not attempt any heuristic python-value conversion. This makes it more natural
to call
fn.whatever().cast('text')and you predictably get text out.View commits
v4.0.6Compare Source
BinaryJSONField: helpers for in-placemodifications (
set,replace,insert,append,update).BinaryJSONField(path_exists,path_match,path_query,path_query_array,path_query_first).fromisoformatas a first attempt since it's faster and more robust.db.connection_context()can be nested cleanly, #3046.pool.close_allandpool.manual_close, #3047.FixedCharField, #3048.View commits
v4.0.5Compare Source
db_value()may not get called in subclasses of PostgresJSONField / BinaryJSONField, refs #3044.
DB drivers. This simplifies checking driver-specific subclasses of standard
DB-API exceptions.
View commits
v4.0.4Compare Source
ImproperlyConfiguredif pg driver unavailable at modeldefinition-time when field db-hooks are used, rather than
AttributeError.View commits
v4.0.3Compare Source
around and trying to group things more clearly. Also added new tests covering
some gaps.
stuff like
.in(a for a in iterable if cond).FOR UPDATEclauses.paginate()method.wrapper.
graphs after multi-table selects.
View commits
v4.0.2Compare Source
db.iterate(query).DataSet module. Previously binary data was encoded as base64, going forward
hex is the new default. For base64 specify
base64_bytes=True.BinaryJSONField, support atomic removal ofsub-elements, as well as alternate helper for extracting sub-elements and
querying array length.
View commits
v4.0.1Compare Source
gr_contextis set on greenlet ingreenlet_spawnso thatcontextvars will be operable in sync handlers.
SqliteExtDatabase(it basically served no purpose in 4.0). UseSqliteDatabaseinstead.corresponding extension module rather than putting all into
playhouse.pool.dumpsoption for postgres JSON fields.View commits
v4.0.0Compare Source
asynciovia a new playhouse extension. Seethe documentation
for details.
PostgresqlDatabasecan usepsycopg(psycopg3) if it is installed. If bothpsycopg2 and psycopg3 are installed, Peewee will prefer psycopg2, but this
can be controlled by specifying
prefer_psycopg3=Truein the constructor.Same applies to
PostgresqlExtDatabase.Psycopg3Databaseclass has been moved toplayhouse.postgres_extand isnow just a thin wrapper around
PostgresqlExtDatabase.relying on the driver-provided
Json()wrapper(s).ISODateTimeFieldfor Sqlite that encodes datetimes in ISO format(more friendly when db is shared with other tools), and also properly reads
back UTC offset info.
playhouse.sqlite_ext.ClosureTableimplementation.Model.dirty_field_namesattribute that is safe for membershiptesting, since testing
x in dirty_fieldsreturns True if one or more fieldexists due to operator overloads returning a truthy Expression object.
Refs #3028.
_sqlite_extextension. The C implementations of the FTSrank functions are moved to
sqlite_udf. Most of the remaining functionalityis moved to
playhouse.cysqlite_extwhich supports it natively.Migrating
CSqliteExtDatabaseusage:You can either use
sqlite_ext.SqliteExtDatabaseor try the newcysqlite_ext.CySqliteDatabaseif you want all the old functionality and arewilling to try a new driver.
View commits
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.