Ejemplo n.º 1
0
 def _get_engine_type(self, cluster: ClickhouseCluster,
                      table_name: str) -> str:
     if cluster.is_single_node():
         return "MergeTree()"
     else:
         zoo_path = self._get_zookeeper_path(cluster, table_name)
         return f"ReplicatedMergeTree({zoo_path}, '{{replica}}')"
Ejemplo n.º 2
0
 def _get_engine_type(self, cluster: ClickhouseCluster,
                      table_name: str) -> str:
     if cluster.is_single_node():
         return f"ReplacingMergeTree({self.__version_column})"
     elif self._unsharded is True:
         return f"ReplicatedReplacingMergeTree('/clickhouse/tables/{self._storage_set_value}/all/{table_name}', '{{replica}}', {self.__version_column})"
     else:
         return f"ReplicatedReplacingMergeTree('/clickhouse/tables/{self._storage_set_value}/{{shard}}/{table_name}', '{{replica}}', {self.__version_column})"
Ejemplo n.º 3
0
 def _get_engine_type(self, cluster: ClickhouseCluster, table_name: str) -> str:
     database_name = cluster.get_database()
     if cluster.is_single_node():
         return "MergeTree()"
     elif self._unsharded is True:
         return f"ReplicatedMergeTree('/clickhouse/tables/{self._storage_set_value}/all/{database_name}/{table_name}', '{{replica}}')"
     else:
         return f"ReplicatedMergeTree('/clickhouse/tables/{self._storage_set_value}/{{shard}}/{database_name}/{table_name}', '{{replica}}')"
Ejemplo n.º 4
0
    def get_sql(self, cluster: ClickhouseCluster, table_name: str) -> str:
        cluster_name = cluster.get_clickhouse_cluster_name()
        assert not cluster.is_single_node()
        assert cluster_name is not None
        database_name = cluster.get_database()
        optional_sharding_key = (f", {self.__sharding_key}"
                                 if self.__sharding_key else "")

        return f"Distributed({cluster_name}, {database_name}, {self.__local_table_name}{optional_sharding_key})"
Ejemplo n.º 5
0
 def _get_engine_type(self, cluster: ClickhouseCluster,
                      table_name: str) -> str:
     if cluster.is_single_node():
         if self.__version_column:
             return f"ReplacingMergeTree({self.__version_column})"
         return "ReplacingMergeTree()"
     else:
         zoo_path = self._get_zookeeper_path(cluster, table_name)
         if self.__version_column:
             return f"ReplicatedReplacingMergeTree({zoo_path}, '{{replica}}', {self.__version_column})"
         return f"ReplicatedReplacingMergeTree({zoo_path}, '{{replica}}')"