diff --git a/CHANGELOG.md b/CHANGELOG.md index ac840ac..6b716c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Change Log ========== +Unreleased +---------- +- Add support for compound filters with Q objects (desile) +- Add support for BETWEEN operator (desile) + v0.9.8 ------ - Bug fix: add field names list explicitly to Database.insert method (anci) diff --git a/docs/class_reference.md b/docs/class_reference.md index e56fc7a..7bb9e55 100644 --- a/docs/class_reference.md +++ b/docs/class_reference.md @@ -605,16 +605,17 @@ Adds a DISTINCT clause to the query, meaning that any duplicate rows in the results will be omitted. -#### exclude(**kwargs) +#### exclude(**filter_fields) Returns a copy of this queryset that excludes all rows matching the conditions. -#### filter(**kwargs) +#### filter(*q, **filter_fields) Returns a copy of this queryset that includes only rows matching the conditions. +Add q object to query if it specified. #### only(*field_names) @@ -705,16 +706,17 @@ Adds a DISTINCT clause to the query, meaning that any duplicate rows in the results will be omitted. -#### exclude(**kwargs) +#### exclude(**filter_fields) Returns a copy of this queryset that excludes all rows matching the conditions. -#### filter(**kwargs) +#### filter(*q, **filter_fields) Returns a copy of this queryset that includes only rows matching the conditions. +Add q object to query if it specified. #### group_by(*args) diff --git a/src/infi/clickhouse_orm/query.py b/src/infi/clickhouse_orm/query.py index 7c2d84b..487a836 100644 --- a/src/infi/clickhouse_orm/query.py +++ b/src/infi/clickhouse_orm/query.py @@ -7,7 +7,6 @@ from .utils import comma_join # TODO -# - and/or between Q objects # - check that field names are valid # - operators for arrays: length, has, empty @@ -120,7 +119,7 @@ class BetweenOperator(Operator): value1 = field.to_db_string( field.to_python(value[1], pytz.utc)) if value[1] is not None or len(str(value[1])) > 0 else None if value0 and value1: - return '%s BETWEEN %s and %s' % (field_name, value0, value1) + return '%s BETWEEN %s AND %s' % (field_name, value0, value1) if value0 and not value1: return ' '.join([field_name, '>=', value0]) if value1 and not value0: