Skip to content

Releases: coleifer/peewee

3.3.2

01 May 15:49
Compare
Choose a tag to compare
  • Add methods for union(), union_all, intersect() and except_(). Previously, these methods were only available as operator overloads.
  • Removed some Python 2.6-specific support code, as 2.6 is no longer officially supported.
  • Fixed model-graph resolution logic for deferred foreign-keys.
  • Better support for UPDATE...FROM queries (Postgresql).

View commits

3.3.1

26 Apr 21:12
Compare
Choose a tag to compare
  • Fixed long-standing bug in 3.x regarding using column aliases with queries that utilize the ModelCursorWrapper (typically queries with one or more joins). If you're using an ancient version of SQLite (3.8 or older) you may need to manually add .alias('column_name') to selected fields if you find that the values are unexpectedly empty after upgrading.
  • Fix typo in model metadata code, thanks @klen.
  • Add examples of using recursive CTEs to docs.

View commits

3.3.0

24 Apr 21:25
Compare
Choose a tag to compare
  • Added support for SQLite's new ON CONFLICT clause, which is modelled on the syntax used by Postgresql and will be available in SQLite 3.24.0 and onward.
  • Added better support for using common table expressions and a cleaner way of implementing recursive CTEs, both of which are also tested with integration tests (as opposed to just checking the generated SQL).
  • Modernized the CI environment to utilize the latest MariaDB features, so we can test window functions and CTEs with MySQL (when available).
  • Reorganized and unified the feature-flags in the test suite.

View commits

3.2.5

19 Apr 16:10
Compare
Choose a tag to compare
  • Added ValuesList for representing values lists. Docs.
  • DateTimeField, DateField and TimeField will parse formatted-string before sending to the database. Previously this only occurred when reading values from the database.

View commits

3.2.4

18 Apr 19:05
Compare
Choose a tag to compare
  • Smarter handling of model-graph when dealing with compound queries (union, intersect, etc). #1579.
  • If the same column-name is selected multiple times, first value wins. #1579.
  • If ModelSelect.switch() is called without any arguments, default to the query's model. Refs #1573.
  • Fix issue where cloning a ModelSelect query did not result in the joins being cloned. #1576.

View commits

3.2.3

16 Apr 02:45
Compare
Choose a tag to compare
  • pwiz tool will capture column defaults defined as part of the table schema.
  • Fixed a misleading error message - #1563.
  • Ensure reuse_if_open parameter has effect on pooled databases.
  • Added support for on update/delete when migrating foreign-key.
  • Fixed bug in SQL generation for subqueries in aliased functions #1572.

View commits

3.2.2

01 Apr 14:23
Compare
Choose a tag to compare
  • Added support for passing Model classes to the returning() method when
    you intend to return all columns for the given model.
  • Fixed a bug when using user-defined sequences, and the underlying sequence
    already exists.
  • Added drop_sequences parameter to drop_table() method which allows you to
    conditionally drop any user-defined sequences when dropping the table.

View commits

3.2.1

31 Mar 14:22
Compare
Choose a tag to compare

Notice: the default mysql driver for Peewee has changed to pymysql
in version 3.2.1. In previous versions, if both mysql-python and pymysql
were installed, Peewee would use mysql-python. As of 3.2.1, if both libraries
are installed Peewee will use pymysql.

  • Added new module playhouse.mysql_ext which includes MySQLConnectorDatabase, a database implementation that works with the mysql-connector driver.
  • Added new field to ColumnMetadata class which captures a database column's default value. ColumnMetadata is returned by Database.get_columns().
  • Added documentation on making Peewee async.

View commits

3.2.0

28 Mar 19:46
Compare
Choose a tag to compare

The 3.2.0 release introduces a potentially backwards-incompatible change. The
only users affected will be those that have implemented custom Field types
with a user-defined coerce method. tl/dr: rename the coerce attribute to
adapt and you should be set.

Field.coerce renamed to Field.adapt

The Field.coerce method has been renamed to Field.adapt. The purpose of
this method is to convert a value from the application/database into the
appropriate Python data-type. For instance, IntegerField.adapt is simply the
int built-in function.

The motivation for this change is to support adding metadata to any AST node
instructing Peewee to not coerce the associated value. As an example, consider
this code:

class Note(Model):
    id = AutoField()  # autoincrementing integer primary key.
    content = TextField()

# Query notes table and cast the "id" to a string and store as "id_text" attr.
query = Note.select(Note.id.cast('TEXT').alias('id_text'), Note.content)

a_note = query.get()
print((a_note.id_text, a_note.content))

# Prior to 3.2.0 the CAST is "un-done" because the value gets converted
# back to an integer, since the value is associated with the Note.id field:
(1, u'some note')  # 3.1.7, e.g. -- "id_text" is an integer!

# As of 3.2.0, CAST will automatically prevent the conversion of field values,
# which is an extension of a more general metadata API that can instruct Peewee
# not to convert certain values.
(u'1', u'some note')  # 3.2.0 -- "id_text" is a string as expected.

If you have implemented custom Field classes and are using coerce to
enforce a particular data-type, you can simply rename the attribute to adapt.

Other changes

Old versions of SQLite do not strip quotation marks from aliased column names
in compound queries (e.g. UNION). Fixed in 3.2.0.

View commits

3.1.7

28 Mar 19:46
Compare
Choose a tag to compare

For all the winblows lusers out there, added an option to skip compilation of the SQLite C extensions during installation. Set env var NO_SQLITE=1 and run setup.py install and you should be able to build without requiring SQLite.

View commits