mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2025-08-02 11:10:11 +03:00
Support FINAL on distributed tables
Support the FINAL modifier on distributed collapsing- and replacingmergetree tables.
This commit is contained in:
parent
7c90c1e4c3
commit
fedd6c6020
|
@ -539,8 +539,20 @@ class QuerySet(object):
|
||||||
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 the `CollapsingMergeTree` and `ReplacingMergeTree` engines only.
|
Can be used with the `CollapsingMergeTree` and `ReplacingMergeTree` engines only.
|
||||||
"""
|
"""
|
||||||
from .engines import CollapsingMergeTree, ReplacingMergeTree
|
from .engines import CollapsingMergeTree, ReplacingMergeTree, Distributed
|
||||||
if not isinstance(self._model_cls.engine, (CollapsingMergeTree, ReplacingMergeTree)):
|
|
||||||
|
_engine = self._model_cls.engine
|
||||||
|
|
||||||
|
if isinstance(_engine, (Distributed)):
|
||||||
|
# find the "real" engine for the Distributed table
|
||||||
|
children = self._model_cls.mro()
|
||||||
|
for child in children:
|
||||||
|
# we asume the first that is not Distributed is the child.
|
||||||
|
if isinstance(child.engine, (Distributed)): continue
|
||||||
|
_engine = child.engine
|
||||||
|
break
|
||||||
|
|
||||||
|
if not isinstance(_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')
|
||||||
|
|
||||||
qs = copy(self)
|
qs = copy(self)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user