peewee 3.4.0

Peewee is a minimalistic but expressive ORM library for Python. It comes in a single module and file, but supports SQLite, Mysql and Postgres, and comes with extensive documentation. It simplifies model declarations, result set iteration, and provides a rather pythonic way of query building through operator overloading.

Tags python orm flask developers python-module
License MITL
State stable

Recent Releases

3.4.021 May 2018 21:25 minor feature: The regexp() operation is now case-sensitive for MySQL and Postgres. To perform case-insensitive regexp operations, use iregexp(). The SQLite BareField() field-type now supports all column constraints except specifying the data-type. Previously it silently ignored any column constraints. LIMIT and OFFSET parameters are now treated as parameterized values instead of literals. The schema parameter for SQLite database introspection methods is no longer ignored by default. The schema corresponds to the name given to an attached database. ArrayField now accepts a new parameter field_kwargs, which is used to pass information to the array field's field_class initializer. SQLite backup interface supports specifying page-counts and a user-defined progress handler. GIL is released when doing backups or during SQLite busy timeouts (when using the peewee SQLite busy-handler). Add NATURAL join-type to the JOIN helper. Improved identifier quoting to allow specifying distinct open/-quote characters. Enables adding support for MSSQL, for instance, which uses square brackets, e.g. table . column . Unify timeout interfaces for SQLite databases (use seconds everywhere rather than mixing seconds and milliseconds, which was confusing). Added attach() and detach() methods to SQLite database, making it possible to attach additional databases (e.g. an in-memory cache db).
3.3.409 May 2018 00:25 minor feature: Added a BinaryUUIDField class for efficiently storing UUIDs in 16-bytes. Dataset's update_cache() logic so that when updating a single table that was newly-added, we also ensure that all dependent tables are updated at the same time. Refs coleifer/sqlite-web#42.
3.3.304 May 2018 23:25 minor feature: More efficient implementation of model dependency-graph generation. Improves performance of recursively deleting related objects by omitting unnecessary subqueries. Added union(), union_all(), intersect() and except_() to the Model-specific query implementations. This was an oversight that should have been patched in 3.3.2, but is in 3.3.3. Major cleanup to test runner and standardized test skipping logic to integrate with standard-library unittest conventions.
3.3.130 Apr 2018 20:45 minor feature: Long-standing 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. Typo in model metadata code, thanks @klen. Add examples of using recursive CTEs to docs.
3.3.026 Apr 2018 13:25 minor feature: 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.
3.2.522 Apr 2018 23:25 minor feature: 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.
3.2.318 Apr 2018 08:25 minor feature: pwiz tool will capture column defaults defined as part of the table schema. 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. in SQL generation for subqueries in aliased functions #1572.
3.2.204 Apr 2018 21:25 minor feature: Added support for passing Model classes to the returning() method when You intend to return all columns for the given model. a 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.
3.2.031 Mar 2018 17:45 minor feature: Add `_coerce` metadata attribute to `Node`. . Test cast() with MySQL using CHAR data-type. . Additional test-case using field names and explicit casts. . Add test with join/aggregate/group. . Do not return model instances from multi-model compound selects. . Strip quotes from alias identifiers. . Remove multi-model union restriction. . Strip quotes from column name after splitting off pre. . 3.2.0.
3.1.627 Mar 2018 21:05 minor feature: Added rekey() method to SqlCipher database for changing encryption key and documentation for set_passphrase() method. Added convert_values parameter to ArrayField constructor, which will cause the array values to be processed using the underlying data-type's conversion logic. unreported using TimestampField with sub-second resolutions. where options were not being processed when calling drop_table(). Some and improvements to signals extension.
3.1.515 Mar 2018 13:05 minor feature: Python 3.x incompatibility with izip_longest(). . 3.1.5.
3.1.312 Mar 2018 03:05 minor feature: where scope-specific settings were being updated in-place instead of copied. #1534. where setting a ForeignKeyField did not add it to the model's "dirty" fields list. #1530. Use pre-fetched data when using prefetch() with ManyToManyField. Thanks to @iBelieve for the patch. #1531. Use JSON data-type for SQLite JSONField instances. Add a json_contains function for use with SQLite json1 extension. Various documentation updates and additions.
3.1.202 Mar 2018 09:45 minor feature: More robust handling of INSERT+RETURNING. Refs #1522. . 3.1.2.
3.1.027 Feb 2018 02:05 minor feature: Database.bind(). Database.bind_ctx(). Removed Python 2.6 support code from a few places. example analytics app code to ensure hstore extension is registered. Small efficiency improvement to bloom filter. Removed "attention!" from README.
3.0.1922 Feb 2018 18:25 minor feature: Support for more types of mappings in insert_many(), refs #1495. Lots of documentation improvements. when calling tuples() on a ModelRaw query. This was reported originally as a with sqlite-web CSV export. See coleifer/sqlite-web#38.
3.0.1818 Feb 2018 06:45 minor feature: Improved error messages when attempting to use a database class for which the Corresponding driver is not installed. Added tests showing the use of custom operator (a-la the docs). Indentation in docs, #1493. With the SQLite date_part, #1494.
3.0.1713 Feb 2018 05:45 minor feature: Schema inheritance regression, #1485. Add helper method to postgres migrator for setting search_path, #1353.
3.0.1610 Feb 2018 03:16 minor feature: Improve model graph resolution when iterating results of a query. Refs #1482. Allow Model._meta.schema to be changed at run-time. #1483.
3.0.1306 Feb 2018 03:16 minor feature: Where simple field aliases were being ignored. More strict about column type inference for postgres + pwiz.
3.0.1003 Feb 2018 03:16 minor feature: Database.drop_tables() signature to support cascade argument - #1453. Querying documentation for custom functions - #1454. Added len() method to ModelBase for convenient counting. Related to unsaved relation population - #1459. Count() on compound select - #1460. Support coerce keyword argument with fn.XXX() - #1463. Support updating existing model instance with dict_to_model-like API - #1456. Equality tests with ArrayField - #1461.
3.0.230 Jan 2018 11:45 minor feature: Fucking hell. . 3.0.2.
2.10.211 Oct 2017 14:45 minor feature: Update travis-ci build scripts to use Postgres 9.6 and test against Python 3.6. Added support for returning namedtuple objects when iterating over a Cursor. Added support for specifying the "object id" attribute used when declaring a Foreign key. By default, it is foreign-key-name_id, but it can now be Customized. Small in the calculation of search scores when using the SQLite C Extension or the sqlite_ext module. Support literal column names with the dataset module.
2.10.113 May 2017 16:45 minor feature: Remove the playhouse.fields.AESEncryptedField over security concerns described in. Correctly resolve explicit table dependencies when creating tables, refs#1076. Thanks @maaaks. Implement not equals comparison for CompositeKey.
2.10.009 May 2017 08:25 minor feature: Remove the playhouse.fields.AESEncryptedField over security concerns described in. Correctly resolve explicit table dependencies when creating tables, refs#1076. Thanks @maaaks. Implement not equals comparison for CompositeKey.
2.9.208 Apr 2017 07:25 minor feature: #820 - some related to the Cython extension build process. #858 - allow blanks and perform type conversion when using the db_url. Extension. #895 - added the ability to query using the _id attribute. #922 - ensure that peewee.OperationalError is raised consistently when. Using the RetryOperationalError mixin. #929 - ensure that pwiz will import the appropriate extensions when. Vendor-specific fields are used. #930 - ensure that pwiz-generated models containing UnknownField. Placeholders do not blow up when you instantiate them. #932 - correctly limit the length of automatically-generated index names. #933 - where BlobField could not be used if it's parent model. Pointed to an uninitialized database Proxy. #935 - greater consistency with the conversion to Python data-types when. Performing aggregations, annotations, or calling scalar(). #939 - ensure the correct data-types are used when initializing a connection. Pool. #947 - where Signal subclasses were not returning rows affected on. Save. #948 - added documentation about SQLite limits and how they affectinsert_many. #951 - better warnings regarding C extension compilation, thanks @dhaase-de. #968 - where table names starting with numbers generated invalid. Table names when using pwiz. #971 - where parameter was not being used. Thanks @jberkel. #974 - the way SqliteExtDatabase handles the automatic rowid (anddocid) columns. Thanks for alerting me to the and providing a. Failing test case @jberkel. #976 - obscure relating to cloning foreign key fields twice. #981 - allow set instances to be used on the right-hand side of IN exprs. #983 - behavior where the default id primary key was inherited. Regardless. When users would inadvertently include it in their queries, it Would use the table alias of it's parent class. #992 - add support for db_column in djpeewee. #995 - the behavior of truncate_date with Postgresql. Thanks @Zverik. #1009 - allow DATABASE_URL as a recognized parameter to the Flask co
2.9.113 Mar 2017 10:05 minor feature: #820 - some related to the Cython extension build process. #858 - allow blanks and perform type conversion when using the db_url. Extension. #895 - added the ability to query using the _id attribute. #922 - ensure that peewee.OperationalError is raised consistently when. Using the RetryOperationalError mixin. #929 - ensure that pwiz will import the appropriate extensions when. Vendor-specific fields are used. #930 - ensure that pwiz-generated models containing UnknownField. Placeholders do not blow up when you instantiate them. #932 - correctly limit the length of automatically-generated index names. #933 - where BlobField could not be used if it's parent model. Pointed to an uninitialized database Proxy. #935 - greater consistency with the conversion to Python data-types when. Performing aggregations, annotations, or calling scalar(). #939 - ensure the correct data-types are used when initializing a connection. Pool. #947 - where Signal subclasses were not returning rows affected on. Save. #948 - added documentation about SQLite limits and how they affectinsert_many. #951 - better warnings regarding C extension compilation, thanks @dhaase-de. #968 - where table names starting with numbers generated invalid. Table names when using pwiz. #971 - where parameter was not being used. Thanks @jberkel. #974 - the way SqliteExtDatabase handles the automatic rowid (anddocid) columns. Thanks for alerting me to the and providing a. Failing test case @jberkel. #976 - obscure relating to cloning foreign key fields twice. #981 - allow set instances to be used on the right-hand side of IN exprs. #983 - behavior where the default id primary key was inherited. Regardless. When users would inadvertently include it in their queries, it Would use the table alias of it's parent class. #992 - add support for db_column in djpeewee. #995 - the behavior of truncate_date with Postgresql. Thanks @Zverik. #1009 - allow DATABASE_URL as a recognized parameter to the Flask co
2.9.007 Mar 2017 06:45 minor feature: #820 - some related to the Cython extension build process. #858 - allow blanks and perform type conversion when using the db_url. Extension. #895 - added the ability to query using the _id attribute. #922 - ensure that peewee.OperationalError is raised consistently when. Using the RetryOperationalError mixin. #929 - ensure that pwiz will import the appropriate extensions when. Vendor-specific fields are used. #930 - ensure that pwiz-generated models containing UnknownField. Placeholders do not blow up when you instantiate them. #932 - correctly limit the length of automatically-generated index names. #933 - where BlobField could not be used if it's parent model. Pointed to an uninitialized database Proxy. #935 - greater consistency with the conversion to Python data-types when. Performing aggregations, annotations, or calling scalar(). #939 - ensure the correct data-types are used when initializing a connection. Pool. #947 - where Signal subclasses were not returning rows affected on. Save. #948 - added documentation about SQLite limits and how they affectinsert_many. #951 - better warnings regarding C extension compilation, thanks @dhaase-de. #968 - where table names starting with numbers generated invalid. Table names when using pwiz. #971 - where parameter was not being used. Thanks @jberkel. #974 - the way SqliteExtDatabase handles the automatic rowid (anddocid) columns. Thanks for alerting me to the and providing a. Failing test case @jberkel. #976 - obscure relating to cloning foreign key fields twice. #981 - allow set instances to be used on the right-hand side of IN exprs. #983 - behavior where the default id primary key was inherited. Regardless. When users would inadvertently include it in their queries, it Would use the table alias of it's parent class. #992 - add support for db_column in djpeewee. #995 - the behavior of truncate_date with Postgresql. Thanks @Zverik. #1009 - allow DATABASE_URL as a recognized parameter to the Flask co
2.8.802 Mar 2017 06:05 minor feature: #820 - some related to the Cython extension build process. #858 - allow blanks and perform type conversion when using the db_url. Extension. #895 - added the ability to query using the _id attribute. #922 - ensure that peewee.OperationalError is raised consistently when. Using the RetryOperationalError mixin. #929 - ensure that pwiz will import the appropriate extensions when. Vendor-specific fields are used. #930 - ensure that pwiz-generated models containing UnknownField. Placeholders do not blow up when you instantiate them. #932 - correctly limit the length of automatically-generated index names. #933 - where BlobField could not be used if it's parent model. Pointed to an uninitialized database Proxy. #935 - greater consistency with the conversion to Python data-types when. Performing aggregations, annotations, or calling scalar(). #939 - ensure the correct data-types are used when initializing a connection. Pool. #947 - where Signal subclasses were not returning rows affected on. Save. #948 - added documentation about SQLite limits and how they affectinsert_many. #951 - better warnings regarding C extension compilation, thanks @dhaase-de. #968 - where table names starting with numbers generated invalid. Table names when using pwiz. #971 - where parameter was not being used. Thanks @jberkel. #974 - the way SqliteExtDatabase handles the automatic rowid (anddocid) columns. Thanks for alerting me to the and providing a. Failing test case @jberkel. #976 - obscure relating to cloning foreign key fields twice. #981 - allow set instances to be used on the right-hand side of IN exprs. #983 - behavior where the default id primary key was inherited. Regardless. When users would inadvertently include it in their queries, it Would use the table alias of it's parent class. #992 - add support for db_column in djpeewee. #995 - the behavior of truncate_date with Postgresql. Thanks @Zverik. #1009 - allow DATABASE_URL as a recognized parameter to the Flask co
2.8.723 Feb 2017 03:25 minor feature: #820 - some related to the Cython extension build process. #858 - allow blanks and perform type conversion when using the db_url. Extension. #895 - added the ability to query using the _id attribute. #922 - ensure that peewee.OperationalError is raised consistently when. Using the RetryOperationalError mixin. #929 - ensure that pwiz will import the appropriate extensions when. Vendor-specific fields are used. #930 - ensure that pwiz-generated models containing UnknownField. Placeholders do not blow up when you instantiate them. #932 - correctly limit the length of automatically-generated index names. #933 - where BlobField could not be used if it's parent model. Pointed to an uninitialized database Proxy. #935 - greater consistency with the conversion to Python data-types when. Performing aggregations, annotations, or calling scalar(). #939 - ensure the correct data-types are used when initializing a connection. Pool. #947 - where Signal subclasses were not returning rows affected on. Save. #948 - added documentation about SQLite limits and how they affectinsert_many. #951 - better warnings regarding C extension compilation, thanks @dhaase-de. #968 - where table names starting with numbers generated invalid. Table names when using pwiz. #971 - where parameter was not being used. Thanks @jberkel. #974 - the way SqliteExtDatabase handles the automatic rowid (anddocid) columns. Thanks for alerting me to the and providing a. Failing test case @jberkel. #976 - obscure relating to cloning foreign key fields twice. #981 - allow set instances to be used on the right-hand side of IN exprs. #983 - behavior where the default id primary key was inherited. Regardless. When users would inadvertently include it in their queries, it Would use the table alias of it's parent class. #992 - add support for db_column in djpeewee. #995 - the behavior of truncate_date with Postgresql. Thanks @Zverik. #1009 - allow DATABASE_URL as a recognized parameter to the Flask co
2.8.507 Oct 2016 11:45 minor feature: #820 - some related to the Cython extension build process. #858 - allow blanks and perform type conversion when using the db_url. Extension. #895 - added the ability to query using the _id attribute. #922 - ensure that peewee.OperationalError is raised consistently when. Using the RetryOperationalError mixin. #929 - ensure that pwiz will import the appropriate extensions when. Vendor-specific fields are used. #930 - ensure that pwiz-generated models containing UnknownField. Placeholders do not blow up when you instantiate them. #932 - correctly limit the length of automatically-generated index names. #933 - where BlobField could not be used if it's parent model. Pointed to an uninitialized database Proxy. #935 - greater consistency with the conversion to Python data-types when. Performing aggregations, annotations, or calling scalar(). #939 - ensure the correct data-types are used when initializing a connection. Pool. #947 - where Signal subclasses were not returning rows affected on. Save. #948 - added documentation about SQLite limits and how they affect. Insert_many. #951 - better warnings regarding C extension compilation, thanks @dhaase-de. #968 - where table names starting with numbers generated invalid. Table names when using pwiz. #971 - where parameter was not being used. Thanks @jberkel. #974 - the way SqliteExtDatabase handles the automatic rowid (and. Docid) columns. Thanks for alerting me to the and providing a Failing test case @jberkel. #976 - obscure relating to cloning foreign key fields twice. #981 - allow set instances to be used on the right-hand side of IN exprs. #983 - behavior where the default id primary key was inherited. Regardless. When users would inadvertently include it in their queries, it Would use the table alias of it's parent class. #992 - add support for db_column in djpeewee. . #995 - the behavior of truncate_date with Postgresql. Thanks @Zverik. #1009 - allow DATABASE_URL as a recognized
2.8.403 Oct 2016 19:05 minor feature: #820 - some related to the Cython extension build process. #858 - allow blanks and perform type conversion when using the db_url. Extension. #895 - added the ability to query using the _id attribute. #922 - ensure that peewee.OperationalError is raised consistently when. Using the RetryOperationalError mixin. #929 - ensure that pwiz will import the appropriate extensions when. Vendor-specific fields are used. #930 - ensure that pwiz-generated models containing UnknownField. Placeholders do not blow up when you instantiate them. #932 - correctly limit the length of automatically-generated index names. #933 - where BlobField could not be used if it's parent model. Pointed to an uninitialized database Proxy. #935 - greater consistency with the conversion to Python data-types when. Performing aggregations, annotations, or calling scalar(). #939 - ensure the correct data-types are used when initializing a connection. Pool. #947 - where Signal subclasses were not returning rows affected on. Save. #948 - added documentation about SQLite limits and how they affect. Insert_many. #951 - better warnings regarding C extension compilation, thanks @dhaase-de. #968 - where table names starting with numbers generated invalid. Table names when using pwiz. #971 - where parameter was not being used. Thanks @jberkel. #974 - the way SqliteExtDatabase handles the automatic rowid (and. Docid) columns. Thanks for alerting me to the and providing a Failing test case @jberkel. #976 - obscure relating to cloning foreign key fields twice. #981 - allow set instances to be used on the right-hand side of IN exprs. #983 - behavior where the default id primary key was inherited. Regardless. When users would inadvertently include it in their queries, it Would use the table alias of it's parent class. #992 - add support for db_column in djpeewee. . #995 - the behavior of truncate_date with Postgresql. Thanks @Zverik. #1009 - allow DATABASE_URL as a recognized
2.8.326 Aug 2016 03:16 minor feature: #820 - some related to the Cython extension build process. #858 - allow blanks and perform type conversion when using the db_url. Extension. #895 - added the ability to query using the _id attribute. #922 - ensure that peewee.OperationalError is raised consistently when. Using the RetryOperationalError mixin. #929 - ensure that pwiz will import the appropriate extensions when. Vendor-specific fields are used. #930 - ensure that pwiz-generated models containing UnknownField. Placeholders do not blow up when you instantiate them. #932 - correctly limit the length of automatically-generated index names. #933 - where BlobField could not be used if it's parent model. Pointed to an uninitialized database Proxy. #935 - greater consistency with the conversion to Python data-types when. Performing aggregations, annotations, or calling scalar(). #939 - ensure the correct data-types are used when initializing a connection. Pool. #947 - where Signal subclasses were not returning rows affected on. Save. #948 - added documentation about SQLite limits and how they affect. Insert_many. #951 - better warnings regarding C extension compilation, thanks @dhaase-de. #968 - where table names starting with numbers generated invalid. Table names when using pwiz. #971 - where parameter was not being used. Thanks @jberkel. #974 - the way SqliteExtDatabase handles the automatic rowid (and. Docid) columns. Thanks for alerting me to the and providing a Failing test case @jberkel. #976 - obscure relating to cloning foreign key fields twice. #981 - allow set instances to be used on the right-hand side of IN exprs. #983 - behavior where the default id primary key was inherited. Regardless. When users would inadvertently include it in their queries, it Would use the table alias of it's parent class. #992 - add support for db_column in djpeewee. . #995 - the behavior of truncate_date with Postgresql. Thanks @Zverik. #1009 - allow DATABASE_URL as a recognized
2.8.210 Aug 2016 19:05 minor feature: #820 - some related to the Cython extension build process. #858 - allow blanks and perform type conversion when using the db_url. Extension. #895 - added the ability to query using the _id attribute. #922 - ensure that peewee.OperationalError is raised consistently when. Using the RetryOperationalError mixin. #929 - ensure that pwiz will import the appropriate extensions when. Vendor-specific fields are used. #930 - ensure that pwiz-generated models containing UnknownField. Placeholders do not blow up when you instantiate them. #932 - correctly limit the length of automatically-generated index names. #933 - where BlobField could not be used if it's parent model. Pointed to an uninitialized database Proxy. #935 - greater consistency with the conversion to Python data-types when. Performing aggregations, annotations, or calling scalar(). #939 - ensure the correct data-types are used when initializing a connection. Pool. #947 - where Signal subclasses were not returning rows affected on. Save. #948 - added documentation about SQLite limits and how they affect. Insert_many. #951 - better warnings regarding C extension compilation, thanks @dhaase-de. #968 - where table names starting with numbers generated invalid. Table names when using pwiz. #971 - where parameter was not being used. Thanks @jberkel. #974 - the way SqliteExtDatabase handles the automatic rowid (and. Docid) columns. Thanks for alerting me to the and providing a Failing test case @jberkel. #976 - obscure relating to cloning foreign key fields twice. #981 - allow set instances to be used on the right-hand side of IN exprs. #983 - behavior where the default id primary key was inherited. Regardless. When users would inadvertently include it in their queries, it Would use the table alias of it's parent class. #992 - add support for db_column in djpeewee. . #995 - the behavior of truncate_date with Postgresql. Thanks @Zverik. #1009 - allow DATABASE_URL as a recognized
2.8.106 May 2016 00:45 minor feature: travis-ci builds now include MySQL and Python 3.5. Dropped support for Python 3.2 and 3.3. Builds also will run the C-extension code. C extension speedups now enabled by default, includes faster implementations for dict and tuple QueryResultWrapper classes, faster date formatting, and a faster field and model sorting. C implementations of SQLite functions is now enabled by default. SQLite extension is now compatible with APSW and can be used in standalone form directly from Python. See SqliteExtDatabase for more details. SQLite C extension now supports murmurhash2. UUIDField is now supported for SQLite and MySQL, using text and varchar respectively, thanks @foxx!. Added BinaryField, thanks again, @foxx!. Added PickledField to playhouse.fields. ManyToManyField now accepts a list of primary keys when adding or removing values from the through relationship. Added support for SQLite table-valued functions using the sqlite-vtfunc library. Significantly simplified the build process for compiling the C extensions. Instead of using a Proxy for defining circular foreign key relationships, you now need to use DeferredRelation. Instead of using a Proxy for defining many-to-many through tables, you now need to use DeferredThroughModel. SQLite Virtual Models must now use Meta.extension_module and Meta.extension_options to declare extension and any options. For more details, see VirtualModel. MySQL database will now COMMIT statements for SELECT queries. This was not necessary, but added due to an influx of confused users creating GitHub. Hint: learn to user your damn database, it's not magic!. with PasswordField and Python3. Fuck Python 3. SortedFieldList and remove_field(). Thanks @klen!. clarified docs for APSW. added docs for request hooks in Pyramid (who uses Pyramid, by the way?). prefetch() only loads first ForeignKeyField for a given relation. typo in docs. foreign keys were not correctly handling coercing to the appropriate python value. cleaned up some
2.8.015 Jan 2016 13:05 minor feature: travis-ci builds now include MySQL and Python 3.5. Dropped support for Python 3.2 and 3.3. Builds also will run the C-extension code. C extension speedups now enabled by default, includes faster implementations for dict and tuple QueryResultWrapper classes, faster date formatting, and a faster field and model sorting. C implementations of SQLite functions is now enabled by default. SQLite extension is now compatible with APSW and can be used in standalone form directly from Python. See SqliteExtDatabase for more details. SQLite C extension now supports murmurhash2. UUIDField is now supported for SQLite and MySQL, using text and varchar respectively, thanks @foxx!. Added BinaryField, thanks again, @foxx!. Added PickledField to playhouse.fields. ManyToManyField now accepts a list of primary keys when adding or removing values from the through relationship. Added support for SQLite table-valued functions using the sqlite-vtfunc library. Significantly simplified the build process for compiling the C extensions. Instead of using a Proxy for defining circular foreign key relationships, you now need to use DeferredRelation. Instead of using a Proxy for defining many-to-many through tables, you now need to use DeferredThroughModel. SQLite Virtual Models must now use Meta.extension_module and Meta.extension_options to declare extension and any options. For more details, see VirtualModel. MySQL database will now COMMIT statements for SELECT queries. This was not necessary, but added due to an influx of confused users creating GitHub. Hint: learn to user your damn database, it's not magic!. with PasswordField and Python3. Fuck Python 3. SortedFieldList and remove_field(). Thanks @klen!. clarified docs for APSW. added docs for request hooks in Pyramid (who uses Pyramid, by the way?). prefetch() only loads first ForeignKeyField for a given relation. typo in docs. foreign keys were not correctly handling coercing to the appropriate python value. cleaned up some
2.7.404 Dec 2015 16:05 minor feature: Check json1 installed. Convert unicode to bytes. Remove get_field methods. _SortedFieldList, Model._meta.remove_field. Keep `order by` clause when prefetching. Automatically clean search queries. Doc clarification re #771. Rename `validate` to `validate_model`, cc @stas. Pyramid docs. Additional assertion. Allow multiple return values from rel_for_model, refs #775. multiple fk prefetch. Move the OR-logic in one level. Proper key helps. Delete deps. Fuck python3. test reverse multi fk prefetching. UUIDField support for sqlite, shuffling tests. Support for additional db url providers. Docs for #781. Compile pysqlite extension if possible.
2.7.325 Nov 2015 10:25 minor feature: install docs update. Update gitignore. Add JSONField to `sqlite_ext`. Updates and docs for JSONField. No unicode literals. Corrections to sorting. 2.7.3.
2.7.221 Nov 2015 08:25 minor feature: PasswordField that uses the bcrypt module. Added new Model Meta.only_save_dirty flag to, by default, only save fields that have been modified. Added support for upsert() on MySQL (in addition to SQLite). Implemented SQLite ranking functions (rank and bm25) in Cython, and changed both the Cython and Python APIs to accept weight values for every column in the search index. This more ly aligns with the APIs provided by FTS5. In fact, made the APIs for FTS4 and FTS5 result ranking compatible. Major changes to the :ref:sqlite_ext module. Function callbacks implemented in Python were implemented in Cython (e.g. date manipulation and regex processing) and will be used if Cython is available when Peewee is installed. Support for the experimental new FTS5 SQLite search extension. Added :py:class:SearchField for use with the SQLite FTS extensions. Added :py:class:RowIDField for working with the special rowid column in SQLite. Added a model class validation hook to allow model subclasses to perform any validation after class construction. This is currently used to ensure that FTS5Model subclasses do not violate any rules required by the FTS5 virtual table. some very broken behavior in the MySQL migrator code. Added more tests. added a RetryOperationalError mixin that will try automatically reconnecting after a failed query. There was a in the previous error handler implementation that made this impossible, which is also. column name regular expression in SQLite migrator. NULL handling with the Postgresql JSONField. added __module__ attribute to DoesNotExist classes. removed the commit_select logic for MySQL databases. added documentation for Meta.order_by API. added cast() method for casting JSON field values. added docs and method override to indicate that SQLite does not support adding foreign key constraints after table creation. Check whether pysqlite or libsqlite were compiled with BerkeleyDB support when using the :py:class:BerkeleyDatabase. Clean up th
2.6.422 Sep 2015 12:25 minor feature: a with the Cython speedups not being included in package. Documented how to create models with no primary key. Allow bare INSERT statements. Regarding foreign key / one-to-one relationships. Allow ArrayField to accept tuples in addition to lists. Regarding unsaved relations. Refactored QueryResultWrapper to allow multiple independent iterations over the same underlying result cache. With multiple joins to same table + eager loading. When connection fails while using an execution context. Use correct column names with non-standard django foreign keys. Return datetime.time instead of timedelta for MySQL time fields. SQLite migrator regular expressions. Thanks @sroebert. #647, #649, #650, added support for RETURNING clauses. Update, Insert and Delete queries can now be called with RETURNING to retrieve the rows that were affected. See docs. Added web request hook docs. Allowed arbitrary model attributes and methods to be serialized by model_to_dict(). Docs. Allow model_to_dict() to introspect query for which fields to serialize. Moved custom fields into their own playhouse module. Docs. Added backend-agnostic truncate_date() implementation. Added a CharField which uses column type CHAR. Added support for arbitrary PRAGMA statements to be run on new SQLite connections. Docs. Removed berkeley_build.sh script. See instructions on my blog instead.
2.6.307 Jul 2015 06:45 minor feature: #641, fixed bug with exception wrapping and Python 2.6. #634, fixed bug where correct query result wrapper was not being used for certain composite queries. #625, cleaned up some example code. #614, fixed bug with aggregate_rows() when there are multiple joins to the same table.
2.6.204 Jul 2015 02:05 minor bugfix: Fixed bug with exception wrapping and Python 2.6. Fixed bug where correct query result wrapper was not being used for certain composite queries. Cleaned up some example code. Fixed bug with aggregate_rows() when there are multiple joins to the same table.
2.6.131 May 2015 01:05 minor feature: Support self-referential joins with prefetch and aggregate_rows() methods. Accomodate changes in SQLite's PRAGMA index_list() return value. Fixed bug where pwiz was not passing table names to introspector. Fixed bug with handling of named cursors in older psycopg2 version. Removed some cruft from the APSWDatabase implementation.
2.6.022 Apr 2015 05:45 minor feature: get_or_create() now returns a 2-tuple consisting of the model instance and a boolean indicating whether the instance was created. The function now behaves just like the Django equivalent. better support for setting the character encoding on Postgresql database connections. Thanks @klen!. Improved implementation of get_or_create().
2.5.106 Apr 2015 20:05 minor bugfix: Fixed a bug regarding parentheses around compound SELECT queries (i.e. UNION, INTERSECT, etc). Fixed unreported bug where table aliases were not generated correctly for compound SELECT queries. Add option to preserve original column order with pwiz. Fixed unreported bug where selecting all columns from a ModelAlias does not use the appropriate FieldAlias objects. Added an option for bulk insert queries to return the list of auto-generated primary keys. See docs for InsertQuery.return_id_list. Added parse function to the playhouse.db_url module. Added hacks section to the docs. Please contribute your hacks! Calls to Node.in_() and Node.not_in() do not take *args anymore and instead take a single argument.
2.5.022 Mar 2015 08:45 major feature: Docs updates. Fixed regression in aggregate_rows(). Fixes bug in pwiz overwriting columns. Correctly cast foreign keys in prefetch(). Simplifies queries issued when doing recursive deletes. Fix cloning of Field objects. Aggregate rows now correctly preserves ordering of joined instances. Unreported, fixed bug to not leave expired connections sitting around in the pool. Added support for Postgresql's jsonb type with BinaryJSONField. Add some basic Flask helpers. Add support for UNION ALL queries. Add SqlCipherExtDatabase, which combines the sqlcipher database with the sqlite extensions. Add option to print metadata when generating code with pwiz.
2.4.705 Feb 2015 09:45 minor feature: #504, Docs updates. #506, Fixed regression in aggregate_rows() #510, Fixes bug in pwiz overwriting columns. #514, Correctly cast foreign keys in prefetch(). #515, Simplifies queries issued when doing recursive deletes. #516, Fix cloning of Field objects. #519, Aggregate rows now correctly preserves ordering of joined instances. Unreported, fixed bug to not leave expired connections sitting around in the pool. . Added support for Postgresql's jsonb type with BinaryJSONField. Add some basic Flask helpers. Add support for UNION ALL queries in #512 Add SqlCipherExtDatabase, which combines the sqlcipher database with the sqlite extensions. Add option to print metadata when generating code with pwiz.
2.4.622 Jan 2015 06:45 minor feature: #503, fixes behavior of aggregate_rows() when used with a CompositeKey. #498, fixes value coercion for field aliases. #492, fixes bug with pwiz and composite primary keys. #486, correctly handle schemas with reflection module. . Peewee has a new ManyToManyField available in the playhouse.shortcuts module. Peewee now has proper support for NOT IN queries through the Node.not_in() method. Models now support iteration. This is equivalent to Model.select().
2.4.523 Dec 2014 11:45 minor feature: #471, #482 and #484, all of which had to do with how joins were handled by the aggregate_rows() query result wrapper. #472 removed some needless special-casing in Model.save(). #466 fixed case-sensitive issues with the SQLite migrator. #474 fixed a handful of bugs that cropped up migrating foreign keys with SQLite. #475 fixed the behavior of the SQLite migrator regarding auto-generated indexes. #479 fixed a bug in the code that stripped extra parentheses in the SQL generator. Fixed a handful of bugs in the APSW extension. . Added connection abstraction called ExecutionContext (see docs). Made all context managers work as decorators (atomic, transaction, savepoint, execution_context). Added explicit methods for IS NULL and IS NOT NULL queries. The latter was actually necessary since the behavior is different from NOT IS NULL (...). Allow disabling backref validation (#465) Made quite a few improvements to the documentation, particularly sections on transactions. Added caching to the DataSet extension, which should improve performance. Made the SQLite migrator smarter with regards to preserving indexes when a table copy is necessary.
2.4.403 Dec 2014 08:05 minor feature: #466, table names are case sensitive in the SQLite migrations module. #465, added option to disable backref validation. #462, use the schema name consistently with postgres reflection. . New model Meta option to disable backref validation. See validate_backrefs. Added documentation on ordering by calculated values. Added basic PyPy compatibility. Added logic to close cursors after they have been exhausted. Structured and consolidated database metadata introspection, including improvements for introspecting indexes. Added support to prefetch for traversing up the query tree. Added introspection option to skip invalid models while introspecting. Added option to limit the tables introspected. Added closed connection detection to the MySQL connection pool. Enhancements to passing options to creating virtual tables with SQLite. Added factory method for generating Closure tables for use with the transitive_closure SQLite extension. Added support for loading SQLite extensions. Numerous test-suite enhancements and new test-cases.
2.4.324 Nov 2014 03:15 minor feature: #466, table names are case sensitive in the SQLite migrations module. #465, added option to disable backref validation. #462, use the schema name consistently with postgres reflection. . New model Meta option to disable backref validation. See validate_backrefs. Added documentation on ordering by calculated values. Added basic PyPy compatibility. Added logic to close cursors after they have been exhausted. Structured and consolidated database metadata introspection, including improvements for introspecting indexes. Added support to prefetch for traversing up the query tree. Added introspection option to skip invalid models while introspecting. Added option to limit the tables introspected. Added closed connection detection to the MySQL connection pool. Enhancements to passing options to creating virtual tables with SQLite. Added factory method for generating Closure tables for use with the transitive_closure SQLite extension. Added support for loading SQLite extensions. Numerous test-suite enhancements and new test-cases.
2.4.220 Nov 2014 03:16 minor feature: #449, typo in the db_url extension, thanks to @malea for the fix. #457 and #458, fixed documentation deficiences. . Added support for importing data when using the DataSet extension. Added an encrypted diary app to the examples. Better index reconstruction when altering columns on SQLite databases with the migrate module. Support for multi-column primary keys in the reflection module. Close cursors more aggressively when executing SELECT queries.
2.3.102 Sep 2014 22:13 minor bugfix: Bugfix release for version 2.3.0 which added: New and improved documentation Added aggregate_rows() method for mitigating N+1 queries. Query compiler performance improvements and rewrite of table alias internals ( 51d82fc and d8d55df ). Added context-managers and decorators for counting queries and asserting query counts. Allow UPDATE queries to contain subqueries for values (example). Support for INSERT INTO / SELECT FROM queries (docs). Allow SqliteDatabase to set the database's journal mode. Added method for concatenation (docs). Moved UUIDField out of the playhouse and into peewee Added pskel script. Documentation for BerkeleyDB.
2.2.501 Aug 2014 04:40 minor bugfix: It's possible to create reusable window definitions now. Support for DISTINCT ON (...) was added, and a BerkeleyDB-extended SQLite build script introduced. UUIDField handling of None values was fixed together with various errors in the example app.