I'm getting results that are incomplete when I try to insert into a cluster. But the results are complete when I insert locally. See example below:
ClickHouse client version 22.3.6.5 (official build).
##Connection string:
connection_string = 'clickhouse+native://db_user:<pass>@host.com:443/default?secure=True&insert_distributed_sync=1'
client = Client.from_url(connection_string)
##Insert Statements:
INSERT INTO db_name.all_accounts (date, id, an) VALUES ('2023-02-01 01:00:00', '800', 'AA1')
INSERT INTO db_name.new_accounts (date, id, an) VALUES ('2023-02-01 01:00:00', '800', 'AA1')
INSERT INTO db_name.all_accounts (date, id, an) VALUES ('2023-02-01 01:00:00', '800', 'BB1')
INSERT INTO db_name.new_accounts (date, id, an) VALUES ('2023-02-01 01:00:00', '800', 'BB1')
INSERT INTO db_name.all_accounts (date, id, an) VALUES ('2023-02-01 01:00:00', '800', 'CC1')
INSERT INTO db_name.new_accounts (date, id, an) VALUES ('2023-02-01 01:00:00', '800', 'CC1')
INSERT INTO db_name.all_accounts (date, id, an) VALUES ('2023-02-01 01:00:00', '800', 'DD1')
INSERT INTO db_name.new_accounts (date, id, an) VALUES ('2023-02-01 01:00:00', '800', 'DD1')
INSERT INTO db_name.all_accounts (date, id, an) VALUES ('2023-02-01 01:00:00', '800', 'EE1')
INSERT INTO db_name.new_accounts (date, id, an) VALUES ('2023-02-01 01:00:00', '800', 'EE1')
##Results:
SELECT *
FROM db_name.new_accounts
GROUP BY
id,
date,
an
ORDER BY id ASC
┌────────────────date─┬─id─┬─an──┐
│ 2023-02-01 01:00:00 │ 800 │ CC1 │
│ 2023-02-01 01:00:00 │ 800 │ AA1 │
│ 2023-02-01 01:00:00 │ 800 │ EE1 │
└─────────────────────┴─────┴─────┘
SELECT *
FROM db_name.all_accounts
GROUP BY
id,
date,
an
ORDER BY id ASC
┌────────────────date─┬─id─┬─an──┐
│ 2023-02-01 01:00:00 │ 800 │ DD1 │
│ 2023-02-01 01:00:00 │ 800 │ AA1 │
│ 2023-02-01 01:00:00 │ 800 │ EE1 │
└─────────────────────┴─────┴─────┘
3 rows in set. Elapsed: 0.011 sec.
Expected results: Both tables should look like:
┌────────────────date─┬─id─┬─an──┐
│ 2023-02-01 01:00:00 │ 800 │ AA1 │
│ 2023-02-01 01:00:00 │ 800 │ BB1 │
│ 2023-02-01 01:00:00 │ 800 │ CC1 │
│ 2023-02-01 01:00:00 │ 800 │ DD1 │
│ 2023-02-01 01:00:00 │ 800 │ EE1 │
└─────────────────────┴─────┴─────┘
I think it maybe the syntax I'm using to append
&insert_distributed_sync=1
But I'm not sure. If I test locally without using the cluster everything works as expected