mirror of
https://github.com/carrotquest/django-clickhouse.git
synced 2024-11-25 10:33:47 +03:00
d4e9a705d1
2) Bug fixes 3) Simple tests on syncing MergeTree and CollapsingMergeTree
28 lines
749 B
Python
28 lines
749 B
Python
from django_clickhouse.clickhouse_models import ClickHouseModel
|
|
from django_clickhouse.engines import MergeTree, CollapsingMergeTree
|
|
from infi.clickhouse_orm import fields
|
|
|
|
from tests.models import TestModel
|
|
|
|
|
|
class ClickHouseTestModel(ClickHouseModel):
|
|
django_model = TestModel
|
|
sync_delay = 5
|
|
|
|
id = fields.Int32Field()
|
|
created_date = fields.DateField()
|
|
value = fields.Int32Field()
|
|
|
|
engine = MergeTree('created_date', ('id',))
|
|
|
|
|
|
class ClickHouseCollapseTestModel(ClickHouseModel):
|
|
django_model = TestModel
|
|
sync_delay = 5
|
|
|
|
id = fields.Int32Field()
|
|
created_date = fields.DateField()
|
|
value = fields.Int32Field()
|
|
sign = fields.Int8Field()
|
|
|
|
engine = CollapsingMergeTree('created_date', ('id',), 'sign') |