django-clickhouse-backend icon indicating copy to clipboard operation
django-clickhouse-backend copied to clipboard

[FEATURE] Add support to official clickhouse-connector

Open PierreF opened this issue 2 months ago • 1 comments

Following https://github.com/jayvynl/django-clickhouse-backend/discussions/131, I'm going to work on a PR to add support for https://github.com/ClickHouse/clickhouse-connect

I'm going to work on a PR which add clickhouse-connect, so both clickhouse-connect and clickhouse-driver. The rational for this choice is:

  • I fear the change might a bit consequent and have new clickhouse-connect an opt-in seems safer
  • clickhouse-connect does not support native protocol, only HTTP protocol, which imply a breaking change

I could think of two way to support this:

  • Either have two "ENGINE", like clickhouse_backend.backend and clickhouse_backend.backend_http
  • Or add a flag to say which driver to use.

I think the flag version is better, e.g. something like:

DATABASES = {
    "clickhouse": {
        "ENGINE": "clickhouse_backend.backend",
        [...]
        "PORT": "8123",
        "OPTIONS": {
            "USE_HTTP_PROTOCOL": True,  # Or should it be "USE_CLICKHOUSE_CONNECT" ?
        },
    },
}

If I encounter other choice while working on the PR, I'll comment on this issue.

PierreF avatar Sep 17 '25 07:09 PierreF