Clickhouse returns us number of inserted rows in its own way, but clickhouse-driver doesn't propagate it to users. Some API relay on rowcount for example Airflow bryzgaloff/airflow-clickhouse-plugin#116
The solution could be as follows:
from clickhouse_driver.progress import Progress
class Cursor(object):
@property
def rowcount(self) -> int:
if self._types:
# a select query or a DDL query on a cluster that returns:
# 'host', 'port', 'status', 'error', 'num_hosts_remaining', 'num_hosts_active'
return self._rowcount
progress: Progress = self._client.last_query.progress
# progress.rows shows number multiplied by number of replicase, progress.written_rows shows correct value
return progress.written_rows
Clickhouse returns us number of inserted rows in its own way, but clickhouse-driver doesn't propagate it to users. Some API relay on rowcount for example Airflow bryzgaloff/airflow-clickhouse-plugin#116
The solution could be as follows: