Skip to content

Commit

Permalink
chore: use shard in query namespacing for backup (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech authored Sep 8, 2023
1 parent d68e8a3 commit 42b02db
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions housewatch/clickhouse/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def run_query_on_shards(
nodes = get_node_per_shard(cluster)
responses = []
for shard, node in nodes:
params["shard"] = shard
final_query = query % (params or {}) if substitute_params else query
client = Client(
host=node["host_address"],
database=settings.CLICKHOUSE_DATABASE,
Expand All @@ -47,10 +49,7 @@ def run_query_on_shards(
send_receive_timeout=30,
password=settings.CLICKHOUSE_PASSWORD,
)
params["shard"] = shard
result = client.execute(
query, params=params, settings=query_settings, with_column_types=True, query_id=query_id
)
result = client.execute(final_query, settings=query_settings, with_column_types=True, query_id=query_id)
response = []
for res in result[0]:
item = {}
Expand Down

0 comments on commit 42b02db

Please sign in to comment.