mirror of
https://github.com/carrotquest/django-clickhouse.git
synced 2024-11-14 13:26:33 +03:00
29 lines
750 B
Python
29 lines
750 B
Python
from infi.clickhouse_orm import fields
|
|
|
|
from django_clickhouse.clickhouse_models import ClickHouseModel
|
|
from django_clickhouse.engines import MergeTree, CollapsingMergeTree
|
|
from tests.models import TestModel
|
|
|
|
|
|
class ClickHouseTestModel(ClickHouseModel):
|
|
django_model = TestModel
|
|
sync_delay = 2
|
|
|
|
id = fields.Int32Field()
|
|
created_date = fields.DateField()
|
|
value = fields.Int32Field()
|
|
|
|
engine = MergeTree('created_date', ('id',))
|
|
|
|
|
|
class ClickHouseCollapseTestModel(ClickHouseModel):
|
|
django_model = TestModel
|
|
sync_delay = 2
|
|
|
|
id = fields.Int32Field()
|
|
created_date = fields.DateField()
|
|
value = fields.Int32Field()
|
|
sign = fields.Int8Field()
|
|
|
|
engine = CollapsingMergeTree('created_date', ('id',), 'sign')
|