From 1b8c4dbec1019d951958a263d3a6cc60bbba2097 Mon Sep 17 00:00:00 2001 From: leenr Date: Sat, 4 Mar 2017 15:29:19 +0300 Subject: [PATCH] Add support for ReplacingMergeTree (https://clickhouse.yandex/reference_en.html#ReplacingMergeTree) --- src/infi/clickhouse_orm/engines.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/infi/clickhouse_orm/engines.py b/src/infi/clickhouse_orm/engines.py index 7c9a94c..9157752 100644 --- a/src/infi/clickhouse_orm/engines.py +++ b/src/infi/clickhouse_orm/engines.py @@ -63,6 +63,19 @@ class SummingMergeTree(MergeTree): return params +class ReplacingMergeTree(MergeTree): + + def __init__(self, date_col, key_cols, ver_col, sampling_expr=None, + index_granularity=8192, replica_table_path=None, replica_name=None): + super(ReplacingMergeTree, self).__init__(date_col, key_cols, sampling_expr, index_granularity, replica_table_path, replica_name) + self.ver_col = ver_col + + def _build_sql_params(self): + params = super(ReplacingMergeTree, self)._build_sql_params() + params.append(self.ver_col) + return params + + class Buffer(Engine): """Here we define Buffer engine Read more here https://clickhouse.yandex/reference_en.html#Buffer