github coleifer/peewee 4.0.7

5 hours ago
  • Fixes for playhouse.pwasyncio: report correct UPDATE / DELETE rowcounts on asyncpg, roll back open transactions when connections are returned to the pool, raise instead of deadlocking when querying during iterate(), and detect the MySQL / MariaDB server version.
  • Additional playhouse.pwasyncio fixes: a second iterate() on a busy connection raises instead of deadlocking, asyncpg exceptions are translated to peewee exception types, registered aggregates / collations / window functions / extensions and timeout are applied to async SQLite connections, :memory: databases use a single connection, atomic() accepts transaction arguments (e.g. lock_type), postgres connection URLs and isolation_level are supported, %% in raw SQL is unescaped, and attempting a query outside the greenlet bridge no longer emits "never awaited" warnings.
  • Fixes for playhouse.pydantic_utils: JSON fields validate as Any (now including 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, and relationships keys are validated.
  • Add a new cross-backend JSONField to core that provides basic operations and 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. See docs. May eventually replace the backend-specific implementations with subclasses that inherit semantics of this new field. Note: playhouse.mysql_ext.JSONField is now the core field. The old json_dumps / json_loads arguments are renamed dumps / loads, the extract() method is removed (use item-access or path()), and MySQL tables are now created with JSON columns rather than TEXT.
  • Eliminate use of deprecated params when connecting to MySQL databases, thanks to @abulgher, #3050.
  • Using 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

im-c6f926cccd

Don't miss a new peewee release

NewReleases is sending notifications on new releases.