Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test,bench}/**/*.{ex,exs}"],
inputs: ["{mix,.formatter}.exs", "{config,lib,test,bench,dev}/**/*.{ex,exs}"],
import_deps: [:stream_data]
]
1 change: 0 additions & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: bench

on:
workflow_dispatch:
pull_request:
push:
branches: [master]
schedule:
Expand Down
44 changes: 14 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
test:
name: "test @ elixir:${{ matrix.elixir }} otp:${{ matrix.otp }} clickhouse:${{ matrix.clickhouse || 'latest' }} tz:${{ matrix.timezone || 'utc' }}${{ matrix.dialyzer && ' +dialyzer' || '' }}${{ matrix.lint && ' +lint' || '' }}"
name: "test @ elixir:${{ matrix.elixir }} otp:${{ matrix.otp }} clickhouse:${{ matrix.clickhouse }} ${{ matrix.dialyzer && ' +dialyzer' || '' }}${{ matrix.lint && ' +lint' || '' }}"
runs-on: ubuntu-latest

env:
Expand All @@ -19,42 +19,26 @@ jobs:
strategy:
matrix:
include:
# some old elixir/erlang version
- elixir: 1.15
otp: 25

# some recent version and non-UTC timezone
- elixir: 1.18
otp: 27
timezone: Europe/Berlin

# the latest elixir/erlang version with all static checks
- elixir: 1.19
otp: 28
# some old elixir/clickhouse version with the minimum supported OTP
# see https://hexdocs.pm/elixir/compatibility-and-deprecations.html#between-elixir-and-erlang-otp
- elixir: "1.18"
otp: "28"
clickhouse: "24.5.4.49"

# the latest versions with all static checks
- elixir: ">0"
otp: ">0"
clickhouse: "latest"
dialyzer: true
lint: true
coverage: true

# Plausible versions
# - https://github.com/plausible/analytics/blob/master/.tool-versions
# - https://github.com/plausible/analytics/blob/master/.github/workflows/elixir.yml
- elixir: 1.19.4
otp: 27.3.4.6
clickhouse: 25.11.5.8

# some older pre-JSON ClickHouse version
# https://github.com/plausible/ch/issues/273
- elixir: 1.18
otp: 28
clickhouse: 24.5.4.49

services:
clickhouse:
image: clickhouse/clickhouse-server:${{ matrix.clickhouse || 'latest' }}
image: clickhouse/clickhouse-server:${{ matrix.clickhouse }}
ports:
- 8123:8123
env:
TZ: ${{ matrix.timezone || 'UTC' }}
# https://github.com/ClickHouse/ClickHouse/issues/75494
CLICKHOUSE_SKIP_USER_SETUP: 1
options: >-
Expand Down Expand Up @@ -110,9 +94,9 @@ jobs:
uses: actions/cache@v5
with:
path: plts
key: plts-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ github.head_ref || github.ref }}
key: plts-${{ steps.beam.outputs.elixir-version }}-${{ github.head_ref || github.ref }}
restore-keys: |
plts-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-refs/heads/master
plts-${{ steps.beam.outputs.elixir-version }}-refs/heads/master

- run: mix dialyzer --format github
if: ${{ matrix.dialyzer }}
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## Unreleased

- **Breaking:** replace DBConnection with NimblePool.
- **Breaking:** require Elixir 1.18 or later for the built-in `JSON` module and Erlang/OTP 28 or later for `:zstd`.
- **Breaking:** `Ch.start_link/1` no longer accepts DBConnection options or connection-level ClickHouse options such as `:database`, `:username`, `:password`, `:settings`, `:timeout`, `:scheme`, `:hostname`, `:port`, and `:transport_opts`. Use `:url` for the endpoint, pass ClickHouse settings per query with `Ch.query/4`'s `:settings` option, and pass ClickHouse/database/auth headers per query with `:headers`.
- **Breaking:** remove DBConnection compatibility APIs and structs such as `Ch.stream/4`, `Ch.run/3`, `Ch.Query`, `Ch.Stream`, DBConnection transactions/checkouts, and DBConnection streaming/collectable inserts.
- **Breaking:** `Ch.query/4` only accepts named query parameters as a map. Positional and pseudo-positional params such as `[value]` with `{$0:Type}` are no longer supported.
- **Breaking:** remove query command detection and the `:command` query option.
- **Breaking:** remove query options `:format`, `:types`, `:encode`, `:decode`, and `:multipart`. Use an `x-clickhouse-format` header or explicit `FORMAT ...` SQL for formats, and pass already-encoded request bodies for inserts.
- **Breaking:** remove automatic RowBinary insert encoding from `Ch.query/4`. Call `Ch.RowBinary.encode_rows/2` or `Ch.RowBinary.encode_names_and_types/2` explicitly and pass the resulting iodata in the query body.
- **Breaking:** remove multipart query parameter requests for now. `multipart: true` is no longer supported; see https://github.com/plausible/ch/issues/344 for restoring it.
- **Breaking:** `Ch.query/4` now returns `%Ch.Result{names: names, rows: rows, headers: headers, data: data}` for successful responses. Decoded `RowBinaryWithNamesAndTypes` responses populate `:names` and `:rows`; raw formats, inserts, DDL, and other empty responses keep the response body in `:data` and leave `:names` and `:rows` as `nil`.
- **Breaking:** successful inserts, DDL, and other empty responses no longer return `%Ch.Result{command: command, num_rows: num_rows}`. `x-clickhouse-summary` written-row counts are no longer surfaced.
- **Breaking:** `Ch.RowBinary` no longer has a separate `:binary` type. Use `:string` for ClickHouse `String`; it now preserves raw bytes and no longer replaces invalid UTF-8 with the replacement character.
- Remove the `Jason` dependency. JSON encoding/decoding now uses Elixir's built-in `JSON` module.
- Add explicit request and response compression support through HTTP headers. `zstd` and `gzip` response bodies are decompressed automatically for decoded `RowBinaryWithNamesAndTypes` and error responses; raw successful responses are kept as received in `Ch.Result.data`.

## 0.8.3 (2026-05-12)

- use DBConnection v2.10 https://github.com/plausible/ch/pull/339
Expand Down
Loading