mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-25 02:03:46 +03:00
Support FINAL for ReplacingMergeTree
This commit is contained in:
parent
3d12bdb556
commit
f35333a7b6
|
@ -5,6 +5,7 @@ Unreleased
|
||||||
----------
|
----------
|
||||||
- Support for model constraints
|
- Support for model constraints
|
||||||
- Support for data skipping indexes
|
- Support for data skipping indexes
|
||||||
|
- Support FINAL for `ReplacingMergeTree` (chripede)
|
||||||
- Added `DateTime64Field` (NiyazNz)
|
- Added `DateTime64Field` (NiyazNz)
|
||||||
- Make `DateTimeField` and `DateTime64Field` timezone-aware (NiyazNz)
|
- Make `DateTimeField` and `DateTime64Field` timezone-aware (NiyazNz)
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ The `field_names` list must match the fields defined in the model, but does not
|
||||||
|
|
||||||
- `line`: the TSV-formatted data.
|
- `line`: the TSV-formatted data.
|
||||||
- `field_names`: names of the model fields in the data.
|
- `field_names`: names of the model fields in the data.
|
||||||
- `timezone_in_use`: the timezone to use when parsing dates and datetimes.
|
- `timezone_in_use`: the timezone to use when parsing dates and datetimes. Some fields use their own timezones.
|
||||||
- `database`: if given, sets the database that this instance belongs to.
|
- `database`: if given, sets the database that this instance belongs to.
|
||||||
|
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ The `field_names` list must match the fields defined in the model, but does not
|
||||||
|
|
||||||
- `line`: the TSV-formatted data.
|
- `line`: the TSV-formatted data.
|
||||||
- `field_names`: names of the model fields in the data.
|
- `field_names`: names of the model fields in the data.
|
||||||
- `timezone_in_use`: the timezone to use when parsing dates and datetimes.
|
- `timezone_in_use`: the timezone to use when parsing dates and datetimes. Some fields use their own timezones.
|
||||||
- `database`: if given, sets the database that this instance belongs to.
|
- `database`: if given, sets the database that this instance belongs to.
|
||||||
|
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ The `field_names` list must match the fields defined in the model, but does not
|
||||||
|
|
||||||
- `line`: the TSV-formatted data.
|
- `line`: the TSV-formatted data.
|
||||||
- `field_names`: names of the model fields in the data.
|
- `field_names`: names of the model fields in the data.
|
||||||
- `timezone_in_use`: the timezone to use when parsing dates and datetimes.
|
- `timezone_in_use`: the timezone to use when parsing dates and datetimes. Some fields use their own timezones.
|
||||||
- `database`: if given, sets the database that this instance belongs to.
|
- `database`: if given, sets the database that this instance belongs to.
|
||||||
|
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ The `field_names` list must match the fields defined in the model, but does not
|
||||||
|
|
||||||
- `line`: the TSV-formatted data.
|
- `line`: the TSV-formatted data.
|
||||||
- `field_names`: names of the model fields in the data.
|
- `field_names`: names of the model fields in the data.
|
||||||
- `timezone_in_use`: the timezone to use when parsing dates and datetimes.
|
- `timezone_in_use`: the timezone to use when parsing dates and datetimes. Some fields use their own timezones.
|
||||||
- `database`: if given, sets the database that this instance belongs to.
|
- `database`: if given, sets the database that this instance belongs to.
|
||||||
|
|
||||||
|
|
||||||
|
@ -858,6 +858,13 @@ Extends Field
|
||||||
#### DateField(default=None, alias=None, materialized=None, readonly=None, codec=None)
|
#### DateField(default=None, alias=None, materialized=None, readonly=None, codec=None)
|
||||||
|
|
||||||
|
|
||||||
|
### DateTime64Field
|
||||||
|
|
||||||
|
Extends DateTimeField
|
||||||
|
|
||||||
|
#### DateTime64Field(default=None, alias=None, materialized=None, readonly=None, codec=None, timezone=None, precision=6)
|
||||||
|
|
||||||
|
|
||||||
### DateTimeField
|
### DateTimeField
|
||||||
|
|
||||||
Extends Field
|
Extends Field
|
||||||
|
@ -865,13 +872,6 @@ Extends Field
|
||||||
#### DateTimeField(default=None, alias=None, materialized=None, readonly=None, codec=None, timezone=None)
|
#### DateTimeField(default=None, alias=None, materialized=None, readonly=None, codec=None, timezone=None)
|
||||||
|
|
||||||
|
|
||||||
### DateTime64Field
|
|
||||||
|
|
||||||
Extends DateTimeField
|
|
||||||
|
|
||||||
#### DateTime64Field(default=None, alias=None, materialized=None, readonly=None, codec=None, precision=6, timezone=None)
|
|
||||||
|
|
||||||
|
|
||||||
### Decimal128Field
|
### Decimal128Field
|
||||||
|
|
||||||
Extends DecimalField
|
Extends DecimalField
|
||||||
|
@ -1217,7 +1217,7 @@ Pass `prewhere=True` to apply the conditions as PREWHERE instead of WHERE.
|
||||||
|
|
||||||
|
|
||||||
Adds a FINAL modifier to table, meaning data will be collapsed to final version.
|
Adds a FINAL modifier to table, meaning data will be collapsed to final version.
|
||||||
Can be used with `CollapsingMergeTree` engine only.
|
Can be used with the `CollapsingMergeTree` and `ReplacingMergeTree` engines only.
|
||||||
|
|
||||||
|
|
||||||
#### limit_by(offset_limit, *fields_or_expr)
|
#### limit_by(offset_limit, *fields_or_expr)
|
||||||
|
@ -1340,7 +1340,7 @@ Pass `prewhere=True` to apply the conditions as PREWHERE instead of WHERE.
|
||||||
|
|
||||||
|
|
||||||
Adds a FINAL modifier to table, meaning data will be collapsed to final version.
|
Adds a FINAL modifier to table, meaning data will be collapsed to final version.
|
||||||
Can be used with `CollapsingMergeTree` engine only.
|
Can be used with the `CollapsingMergeTree` and `ReplacingMergeTree` engines only.
|
||||||
|
|
||||||
|
|
||||||
#### group_by(*args)
|
#### group_by(*args)
|
||||||
|
@ -2744,6 +2744,15 @@ Initializer.
|
||||||
#### toDateTime(**kwargs)
|
#### toDateTime(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
#### toDateTime64(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
#### toDateTime64OrNull(precision, timezone=NO_VALUE)
|
||||||
|
|
||||||
|
|
||||||
|
#### toDateTime64OrZero(precision, timezone=NO_VALUE)
|
||||||
|
|
||||||
|
|
||||||
#### toDateTimeOrNull()
|
#### toDateTimeOrNull()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,8 @@
|
||||||
* [BaseFloatField](class_reference.md#basefloatfield)
|
* [BaseFloatField](class_reference.md#basefloatfield)
|
||||||
* [BaseIntField](class_reference.md#baseintfield)
|
* [BaseIntField](class_reference.md#baseintfield)
|
||||||
* [DateField](class_reference.md#datefield)
|
* [DateField](class_reference.md#datefield)
|
||||||
* [DateTimeField](class_reference.md#datetimefield)
|
|
||||||
* [DateTime64Field](class_reference.md#datetime64field)
|
* [DateTime64Field](class_reference.md#datetime64field)
|
||||||
|
* [DateTimeField](class_reference.md#datetimefield)
|
||||||
* [Decimal128Field](class_reference.md#decimal128field)
|
* [Decimal128Field](class_reference.md#decimal128field)
|
||||||
* [Decimal32Field](class_reference.md#decimal32field)
|
* [Decimal32Field](class_reference.md#decimal32field)
|
||||||
* [Decimal64Field](class_reference.md#decimal64field)
|
* [Decimal64Field](class_reference.md#decimal64field)
|
||||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import unicode_literals
|
||||||
import pytz
|
import pytz
|
||||||
from copy import copy, deepcopy
|
from copy import copy, deepcopy
|
||||||
from math import ceil
|
from math import ceil
|
||||||
from .engines import CollapsingMergeTree, ReplacingMergeTree
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from .utils import comma_join, string_or_func
|
from .utils import comma_join, string_or_func
|
||||||
|
|
||||||
|
@ -538,8 +537,9 @@ class QuerySet(object):
|
||||||
def final(self):
|
def final(self):
|
||||||
"""
|
"""
|
||||||
Adds a FINAL modifier to table, meaning data will be collapsed to final version.
|
Adds a FINAL modifier to table, meaning data will be collapsed to final version.
|
||||||
Can be used with `CollapsingMergeTree` engine only.
|
Can be used with the `CollapsingMergeTree` and `ReplacingMergeTree` engines only.
|
||||||
"""
|
"""
|
||||||
|
from .engines import CollapsingMergeTree, ReplacingMergeTree
|
||||||
if not isinstance(self._model_cls.engine, (CollapsingMergeTree, ReplacingMergeTree)):
|
if not isinstance(self._model_cls.engine, (CollapsingMergeTree, ReplacingMergeTree)):
|
||||||
raise TypeError('final() method can be used only with the CollapsingMergeTree and ReplacingMergeTree engines')
|
raise TypeError('final() method can be used only with the CollapsingMergeTree and ReplacingMergeTree engines')
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ class QuerySetTestCase(TestCaseWithData):
|
||||||
self._test_qs(qs[80:], 20)
|
self._test_qs(qs[80:], 20)
|
||||||
|
|
||||||
def test_final(self):
|
def test_final(self):
|
||||||
# Final can be used with CollapsingMergeTree engine only
|
# Final can be used with CollapsingMergeTree/ReplacingMergeTree engines only
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
Person.objects_in(self.database).final()
|
Person.objects_in(self.database).final()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user