Peewee v2.2.0 Release Notes
-
๐ This release contains a large refactoring of the way SQL was generated for both โก๏ธ the standard query classes (
Select
,Insert
,Update
,Delete
) as well as for the DDL methods (create_table
,create_index
, etc). Instead of joining strings of SQL and manually quoting things, I've createdClause
objects containing multipleNode
objects to represent all parts of the query.I also changed the way peewee determins the SQL to represent a field. Now a field implements
__ddl__
and__ddl_column__
methods. The former creates the entire field definition, e.g.:"quoted_column_name" <result of call to __ddl_column__> [NOT NULL/PRIMARY KEY/DEFAULT NEXTVAL(...)/CONSTRAINTS...]
The latter method is responsible just for the column type definition. This might ๐ return
VARCHAR(255)
or simplyTEXT
. I've also added support for arbitrary constraints on each field, so you might have:price = DecimalField(decimal_places=2, constraints=[Check('price > 0')])
๐ Changes in 2.2.0
- ๐จ Refactored query generation for both SQL queries and DDL queries.
- ๐ Support for arbitrary column constraints.
- โช
autorollback
option to theDatabase
class that will roll back the transaction before raising an exception. - โ Added
JSONField
type to thepostgresql_ext
module. - Track fields that are explicitly set, allowing faster saves (thanks @soasme).
- ๐ Allow the
FROM
clause to be an arbitraryNode
object (#290). schema
is a newModel.Mketa
option and is used throughout the code.- ๐ Allow indexing operation on HStore fields (thanks @zdxerr, #293).
๐ Bugs fixed
- โก๏ธ #277 (where calls not chainable with update query)
- #278, use
wraps()
, thanks @lucasmarshall - #284, call
prepared()
aftercreate()
, thanks @soasme. - #286, cursor description issue with pwiz + postgres