- Add
QuerySet.model
to support django-rest-framework 3
- Improve support of ClickHouse v21.9 (mangototango)
- Ignore non-numeric parts in ClickHouse version (mangototango)
- Fix precedence of ~ operator in Q objects (mangototango)
- Support for adding a column to the beginning of a table (meanmail)
- Add stddevPop and stddevSamp functions (k.peskov)
- Support for model constraints
- Support for data skipping indexes
- Support for mutations:
QuerySet.update
andQuerySet.delete
- Added functions for working with external dictionaries
- Support FINAL for
ReplacingMergeTree
(chripede) - Added
DateTime64Field
(NiyazNz) - Make
DateTimeField
andDateTime64Field
timezone-aware (NiyazNz)
Backwards incompatible changes
Previously, DateTimeField
always converted its value from the database timezone to UTC. This is no longer the case: the field's value now preserves the timezone it was defined with, or if not specified - the database's global timezone. This change has no effect if your database timezone is set to UTC.
- Remove unnecessary import of
six
- Dropped support for Python 2.x
- New flexible syntax for database expressions and functions
- Expressions as default values for model fields
- Support for IPv4 and IPv6 fields
- Automatic generation of models by inspecting existing tables
- Convenient ways to import ORM classes
See What's new in version 2 for details.
- Added primary_key parameter to MergeTree engines (M1hacka)
- Support negative enum values (Romamo)
- Support LowCardinality columns in ad-hoc queries
- Support for LIMIT BY in querysets (utapyngo)
- Add support for per-field compression codecs (rbelio, Chocorean)
- Add support for low cardinality fields (rbelio)
- Add PREWHERE support to querysets (M1hacka)
- Add WITH TOTALS support to querysets (M1hacka)
- Extend date field range (trthhrtz)
- Fix parsing of server errors in ClickHouse v19.3.3+
- Fix pagination when asking for the last page on a query that matches no records
- Use HTTP Basic Authentication instead of passing the credentials in the URL
- Support default/alias/materialized for nullable fields
- Add UUIDField (kpotehin)
- Add
log_statements
parameter to database initializer - Fix test_merge which fails on ClickHouse v19.8.3
- Fix querysets using the SystemPart model
- Added
timeout
parameter to database initializer (SUHAR1K) - Added
verify_ssl_cert
parameter to database initializer - Added
final()
method to querysets (M1hacka) - Fixed a migrations problem - cannot add a new materialized field after a regular field
- Bug fix:
QuerySet.count()
ignores slicing - Bug fix: wrong parentheses when building queries using Q objects
- Support Decimal fields
- Added
Database.add_setting
method
- Include alias and materialized fields in queryset results
- Check for database existence, to allow delayed creation
- Added
Database.does_table_exist
method - Support for
IS NULL
andIS NOT NULL
in querysets (kalombos)
- NullableField: take extra_null_values into account in
validate
andto_python
- Added
Field.isinstance
method - Validate the inner field passed to
ArrayField
- Add support for compound filters with Q objects (desile)
- Add support for BETWEEN operator (desile)
- Distributed engine support (tsionyx)
_fields
and_writable_fields
are OrderedDicts - note that this might break backwards compatibility (tsionyx)- Improve error messages returned from the database with the
ServerError
class (tsionyx) - Added support for custom partitioning (M1hacka)
- Added attribute
server_version
to Database class (M1hacka) - Changed
Engine.create_table_sql()
,Engine.drop_table_sql()
,Model.create_table_sql()
,Model.drop_table_sql()
parameter to db from db_name (M1hacka) - Fix parsing of datetime column type when it includes a timezone (M1hacka)
- Rename
Model.system
toModel._system
to prevent collision with a column that has the same name - Rename
Model.readonly
toModel._readonly
to prevent collision with a column that has the same name - The
field_names
argument toModel.to_tsv
is now mandatory - Improve creation time of model instances by keeping a dictionary of default values
- Fix queryset bug when field name contains double underscores (YouCanKeepSilence)
- Prevent exception when determining timezone of old ClickHouse versions (vv-p)
- Bug fix: add field names list explicitly to Database.insert method (anci)
- Added RunPython and RunSQL migrations (M1hacka)
- Allow ISO-formatted datetime values (tsionyx)
- Show field name in error message when invalid value assigned (tsionyx)
- Bug fix: select query fails when query contains '$' symbol (M1hacka)
- Prevent problems with AlterTable migrations related to field order (M1hacka)
- Added documentation about custom fields.
- Add
distinct
method to querysets - Add
AlterTableWithBuffer
migration operation - Support Merge engine (M1hacka)
- Fix python3 compatibility (TvoroG)
- Nullable arrays not supported in latest ClickHouse version
- system.parts table no longer includes "replicated" column in latest ClickHouse version
- Added
QuerySet.paginate()
- Support for basic aggregation in querysets
- Migrations: when creating a table for a
BufferModel
, create the underlying table too if necessary
- Changed license from PSF to BSD
- Nullable fields support (yamiou)
- Support for queryset slicing
- Added
ne
andnot_in
queryset operators - Querysets no longer have a default order unless
order_by
is called - Added
autocreate
flag to database initializer - Fix some Python 2/3 incompatibilities (TvoroG, tsionyx)
- To work around a JOIN bug in ClickHouse,
$table
now inserts only the table name, and the database name is sent in the query params instead
- Major new feature: building model queries using QuerySets
- Refactor and expand the documentation
- Add support for FixedString fields
- Add support for more engine types: TinyLog, Log, Memory
- Bug fix: Do not send readonly=1 when connection is already in readonly mode
- Fix broken Python 3 support (M1hacka)
- Add support for ReplacingMergeTree (leenr)
- Fix problem with SELECT WITH TOTALS (pilosus)
- Update serialization format of DateTimeField to 10 digits, zero padded (nikepan)
- Greatly improve performance when inserting large strings (credit to M1hacka for identifying the problem)
- Reduce memory footprint of Database.insert()
- Always keep datetime fields in UTC internally, and convert server timezone to UTC when parsing query results
- Support for ALIAS and MATERIALIZED fields (M1ha)
- Pagination: passing -1 as the page number now returns the last page
- Accept datetime values for date fields (Zloool)
- Support readonly mode in Database class (tswr)
- Added support for the Buffer table engine (emakarov)
- Added the SystemPart readonly model, which provides operations on partitions (M1ha)
- Added Model.to_dict() that converts a model instance to a dictionary (M1ha)
- Added Database.raw() to perform arbitrary queries (M1ha)
- Accept '0000-00-00 00:00:00' as a datetime value (tsionyx)
- Bug fix: parse_array fails on int arrays
- Improve performance when inserting many rows
- Support array fields
- Support enum fields
- Python 3 support