The configured explicit PRIMARY KEY columns.
Runtime accessors for ClickHouse-specific options configured on Ash resources.
These functions read the configuration produced by the clickhouse DSL block
(see AshClickhouse.DataLayer.Dsl.Macros). They are intentionally kept in a
separate module from the clickhouse macro so that importing the macro module
does not also import these getters — that separation lets a resource define a
local helper named like a DSL key (e.g. table/1) without it being shadowed
by an imported getter.
Usage
defmodule MyApp.MyResource do
use Ash.Resource,
data_layer: AshClickhouse.DataLayer
import AshClickhouse.DataLayer.Dsl.Macros
clickhouse do
table "my_table"
repo MyApp.Repo
database "my_app_dev"
base_filter [status: "active"]
default_context %{tenant: "org_123"}
description "My resource description"
engine "MergeTree()"
order_by "id"
partition_by "toYYYYMM(inserted_at)"
settings "index_granularity = 8192"
end
attributes do
uuid_primary_key :id
attribute :name, :string
end
endOptions
:table— the table name in ClickHouse (overrides the default):repo— theAshClickhouse.Repomodule to use:database— the database to use (overrides repo default):engine— the ClickHouse table engine (default"MergeTree()"):order_by—ORDER BYexpression for the table engine:partition_by—PARTITION BYexpression for the table engine:primary_key— explicit primary key columns (ClickHousePRIMARY KEY):settings— engine settings string:base_filter— a filter applied to all queries on this resource:default_context— context merged into every query/changeset:description— human-readable description of the resource:migrate— whether this resource is included in migrations (defaulttrue):insert_opts— options applied to bulk inserts (e.g.async_insert: 1):mutations_sync— defaultmutations_syncfor ALTER mutations (1/2/nil):index— repeated; declares a data-skipping index (seeclickhouse do ... end)
Summary
Functions
The configured base_filter.
The configured database (overrides repo default).
The configured default_context.
The configured description.
The configured table engine.
The configured data-skipping indexes.
Options applied to bulk inserts for this resource (e.g.
async_insert: 1, wait_for_async_insert: 1).
Whether this resource is included in migrations (default true).
The default mutations_sync value for ALTER TABLE mutations on this resource
(1 = wait on current replica, 2 = wait on all replicas, nil = async).
The configured ORDER BY expression.
The configured PARTITION BY expression.
The configured explicit PRIMARY KEY columns.
The configured repo module.
The configured engine settings string.
The configured table name.
Functions
The configured base_filter.
The configured database (overrides repo default).
The configured default_context.
The configured description.
The configured table engine.
The configured data-skipping indexes.
Options applied to bulk inserts for this resource (e.g.
async_insert: 1, wait_for_async_insert: 1).
Whether this resource is included in migrations (default true).
@spec mutations_sync(module()) :: nil | 1 | 2
The default mutations_sync value for ALTER TABLE mutations on this resource
(1 = wait on current replica, 2 = wait on all replicas, nil = async).
The configured ORDER BY expression.
The configured PARTITION BY expression.
The configured repo module.
The configured engine settings string.
The configured table name.