An Ash data layer for ClickHouse.
This data layer implements the Ash.DataLayer behaviour so that Ash
resources can be backed by a ClickHouse columnar OLAP database. It uses the
clickhouse client under the hood.
Configuration
defmodule MyApp.MyResource do
use Ash.Resource,
data_layer: AshClickhouse.DataLayer
clickhouse do
table "my_table"
repo MyApp.Repo
end
attributes do
uuid_primary_key :id
attribute :name, :string
end
endFeatures Supported
:create/:read/:update/:destroy:filter— fullWHEREsupport:limit/:offset— ClickHouse supports both natively:select— column projection:sort—ORDER BY:distinct—SELECT DISTINCT:multitenancy— database- or attribute-based:bulk_create— batchINSERT:update_query/:destroy_query—ALTER TABLE ... UPDATE/DELETE:calculate— in-memory calculations:composite_primary_key:nested_expressions/:boolean_filter:async_engine:expression_calculation{:aggregate, :count | :sum | :avg | :min | :max}— native aggregates{:query_aggregate, :count | :sum | :avg | :min | :max}- Combination queries (UNION/INTERSECT) — executed by Ash in memory
Features NOT Supported
:transact— ClickHouse has no multi-statement transactions:lock— locking is a no-op:keyset— ClickHouse has no token-based keyset pagination:upsert— ClickHouse has noON CONFLICT(use:create+:update_query):expression_calculation_sort— not supported:aggregate_filter/:aggregate_sort— not supported:update_many— use:update_query:composite_type/:through_relationship:join— JOINs are not yet implemented:filter_relationship/{:exists, :unrelated}/{:aggregate_relationship, _}{:query_aggregate, :list | :first | :exists | :custom}— only count/sum/avg/min/max
Summary
Types
@type t() :: AshClickhouse.Query.t()