All Versions
134
Latest Version
Avg Release Cycle
36 days
Latest Release
-

Changelog History
Page 3

  • v3.12.0 Changes

    November 24, 2019
    • Bulk insert (insert_many() and insert_from()) will now return the row count instead of the last insert ID. If you are using Postgres, peewee will continue to return a cursor that provides an iterator over the newly-inserted primary-key values by default. This behavior is being retained by default for compatibility. Postgres users can simply specify an empty returning() call to disable the cursor and retrieve the rowcount instead.
    • ๐Ÿ‘ Migration extension now supports altering a column's data-type, via the new alter_column_type() method.
    • Added Database.is_connection_usabe() method, which attempts to look at the status of the underlying DB-API connection to determine whether the connection is usable.
    • Common table expressions include a materialized parameter, which can be used to control Postgres' optimization fencing around CTEs.
    • โž• Added BloomFilter.from_buffer() method for populating a bloom-filter from the output of a previous call to the to_buffer() method.
    • ๐Ÿ›  Fixed APSW extension's commit() and rollback() methods to no-op if the database is in auto-commit mode.
    • โž• Added generate_always= option to the IdentityField (defaults to False).

    View commits

  • v3.11.2 Changes

    September 24, 2019
    • Implement hash interface for Alias instances, allowing them to be used in multi-source queries.

    View commits

  • v3.11.1 Changes

    September 23, 2019
    • Fix bug in new _pk / get_id() implementation for models that explicitly have disabled a primary-key.

    View commits

  • v3.11.0 Changes

    September 19, 2019
    • ๐Ÿ›  Fixes #1991. This particular issue involves joining 3 models together in a chain, where the outer two models are empty. Previously peewee would make the middle model an empty model instance (since a link might be needed from the source model to the outermost model). But since both were empty, it is more correct to make the intervening model a NULL value on the foreign-key field rather than an empty instance.
    • An unrelated fix came out of the work on #1991 where hashing a model whose primary-key happened to be a foreign-key could trigger the FK resolution query. This patch fixes the Model._pk and get_id() interfaces so they no longer introduce the possibility of accidentally resolving the FK.
    • ๐Ÿ‘ Allow Field.contains(), startswith() and endswith() to compare against another column-like object or expression.
    • โ†ช Workaround for MySQL prior to 8 and MariaDB handling of union queries inside of parenthesized expressions (like IN).
    • Be more permissive in letting invalid values be stored in a field whose type is INTEGER or REAL, since Sqlite allows this.
    • TimestampField resolution cleanup. Now values 0 and 1 will resolve to a timestamp resolution of 1 second. Values 2-6 specify the number of decimal places (hundredths to microsecond), or alternatively the resolution can still be provided as a power of 10, e.g. 10, 1000 (millisecond), 1e6 (microsecond).
    • When self-referential foreign-keys are inherited, the foreign-key on the subclass will also be self-referential (rather than pointing to the parent model).
    • โž• Add TSV import/export option to the dataset extension.
    • โž• Add item interface to the dataset.Table class for doing primary-key lookup, assignment, or deletion.
    • Extend the mysql ReconnectMixin helper to work with mysql-connector.
    • ๐Ÿ›  Fix mapping of double-precision float in postgres schema reflection. Previously it mapped to single-precision, now it correctly uses a double.
    • ๐Ÿ›  Fix issue where PostgresqlExtDatabase and MySQLConnectorDatabase did not respect the autoconnect setting.

    View commits

  • v3.10.0 Changes

    August 03, 2019
    • โž• Add a helper to playhouse.mysql_ext for creating Match full-text search expressions.
    • โž• Added date-part properties to TimestampField for accessing the year, month, day, etc., within a SQL expression.
    • โž• Added to_timestamp() helper for DateField and DateTimeField that produces an expression returning a unix timestamp.
    • โž• Add autoconnect parameter to Database classes. This parameter defaults to True and is compatible with previous versions of Peewee, in which executing a query on a closed database would open a connection automatically. To make it easier to catch inconsistent use of the database connection, this behavior can now be disabled by specifying autoconnect=False, making an explicit call to Database.connect() needed before executing a query.
    • โž• Added database-agnostic interface for obtaining a random value.
    • ๐Ÿ‘ Allow isolation_level to be specified when initializing a Postgres db.
    • ๐Ÿ‘ Allow hybrid properties to be used on model aliases. Refs #1969.
    • ๐Ÿ‘Œ Support aggregates with FILTER predicates on the latest Sqlite.

    ๐Ÿ”„ Changes

    • ๐Ÿ— More aggressively slot row values into the appropriate field when building objects from the database cursor (rather than using whatever cursor.description tells us, which is buggy in older Sqlite).
    • Be more permissive in what we accept in the insert_many() and insert() methods.
    • When implicitly joining a model with multiple foreign-keys, choose the foreign-key whose name matches that of the related model. Previously, this would have raised a ValueError stating that multiple FKs existed.
    • Improved date truncation logic for Sqlite and MySQL to make more compatible with Postgres' date_trunc() behavior. Previously, truncating a datetime to month resolution would return '2019-08' for example. As of 3.10.0, the Sqlite and MySQL date_trunc implementation returns a full datetime, e.g. '2019-08-01 00:00:00'.
    • Apply slightly different logic for casting JSON values with Postgres. Previously, Peewee just wrapped the value in the psycopg2 Json() helper. In this version, Peewee now dumps the json to a string and applies an explicit cast to the underlying JSON data-type (e.g. json or jsonb).

    ๐Ÿ› Bug fixes

    • ๐Ÿ’พ Save hooks can now be called for models without a primary key.
    • ๐Ÿ›  Fixed bug in the conversion of Python values to JSON when using Postgres.
    • Fix for differentiating empty values from NULL values in model_to_dict.
    • ๐Ÿ›  Fixed a bug referencing primary-key values that required some kind of conversion (e.g., a UUID). See #1979 for details.
    • โž• Add small jitter to the pool connection timestamp to avoid issues when multiple connections are checked-out at the same exact time.

    View commits

  • v3.9.6 Changes

    June 03, 2019
    • ๐Ÿ‘Œ Support nesting the Database instance as a context-manager. The outermost block will handle opening and closing the connection along with wrapping everything in a transaction. Nested blocks will use savepoints.
    • Add new session_start(), session_commit() and session_rollback() interfaces to the Database object to support using transactional controls in situations where a context-manager or decorator is awkward.
    • ๐Ÿ›  Fix error that would arise when attempting to do an empty bulk-insert.
    • Set isolation_level=None in SQLite connection constructor rather than afterwards using the setter.
    • โž• Add create_table() method to Select query to implement CREATE TABLE AS.
    • Cleanup some declarations in the Sqlite C extension.
    • โž• Add new example showing how to implement Reddit's ranking algorithm in SQL.

    View commits

  • v3.9.5 Changes

    April 26, 2019
    • โž• Added small helper for setting timezone when using Postgres.
    • ๐Ÿ‘Œ Improved SQL generation for VALUES clause.
    • ๐Ÿ‘Œ Support passing resolution to TimestampField as a power-of-10.
    • Small improvements to INSERT queries when the primary-key is not an auto-incrementing integer, but is generated by the database server (eg uuid).
    • Cleanups to virtual table implementation and python-to-sqlite value conversions.
    • ๐Ÿ›  Fixed bug related to binding previously-unbound models to a database using a context manager, #1913.

    View commits

  • v3.9.4 Changes

    April 14, 2019
    • โž• Add Model.bulk_update() method for bulk-updating fields across multiple model instances. Docs.
    • โž• Add lazy_load parameter to ForeignKeyField. When initialized with lazy_load=False, the foreign-key will not use an additional query to resolve the related model instance. Instead, if the related model instance is not available, the underlying FK column value is returned (behaving like the "_id" descriptor).
    • โž• Added Model.truncate_table() method.
    • The reflection and pwiz extensions now attempt to be smarter about converting database table and column names into snake-case. To disable this, you can set snake_case=False when calling the Introspector.introspect() method or use the -L (legacy naming) option with the pwiz script.
    • Bulk insert via insert_many() no longer require specification of the fields argument when the inserted rows are lists/tuples. In that case, the fields will be inferred to be all model fields except any auto-increment id.
    • โž• Add DatabaseProxy, which implements several of the Database class context managers. This allows you to reference some of the special features of the database object without directly needing to initialize the proxy first.
    • โž• Add support for window function frame exclusion and added built-in support for the GROUPS frame type.
    • โž• Add support for chaining window functions by extending a previously-declared window function.
    • ๐Ÿ‘ Playhouse Postgresql extension TSVectorField.match() method supports an additional argument plain, which can be used to control the parsing of the TS query.
    • โž• Added very minimal JSONField to the playhouse MySQL extension.

    View commits

  • v3.9.3 Changes

    March 23, 2019
    • โž• Added cross-database support for NULLS FIRST/LAST when specifying the ordering for a query. Previously this was only supported for Postgres. Peewee will now generate an equivalent CASE statement for Sqlite and MySQL.
    • โž• Added EXCLUDED helper for referring to the EXCLUDED namespace used with INSERT...ON CONFLICT queries, when referencing values in the conflicting row data.
    • โž• Added helper method to the model Metadata class for setting the table name at run-time. Setting the Model._meta.table_name directly may have appeared to work in some situations, but could lead to subtle bugs. The new API is Model._meta.set_table_name().
    • โœจ Enhanced helpers for working with Peewee interactively, see doc.
    • ๐Ÿ›  Fix cache invalidation bug in DataSet that was originally reported on the sqlite-web project.
    • ๐Ÿ†• New example script implementing a hexastore.

    View commits

  • v3.9.2 Changes

    March 06, 2019

    ๐Ÿš€ This release contains a fix for a test that was failing when 3.9.1 was tagged and released.

    ๐Ÿ‘€ See 3.9.0 for the bulk of the recent changes.