Unreleased
Features
- Data-skipping indexes. Declare ClickHouse data-skipping indexes
(
minmax,set,bloom_filter,ngrambf_v1,tokenbf_v1) inside theclickhouseblock via the repeatableindexmacro. They are emitted in theCREATE TABLEDDL and added to existing tables withALTER TABLE ... ADD INDEX IF NOT EXISTSbymix ash_clickhouse.migrate. The indextypeis validated against a whitelist at compile time. Seeguides/migrations.mdandguides/resources.md.
Bug fixes
- UUID heuristic no longer corrupts non-UUID string data. Parameters are
now converted to the 16-byte UUID binary form only when the column is
provably UUID-typed (via
Dsl.uuid_attribute_names/1), instead of whenever a 36-character string merely looked like a UUID. This prevents legitimate:stringbusiness identifiers (order numbers, etc.) from being mangled on insert/update and in WHERE filters. - Removed dead
Module.get_attribute/2fallbacks inresolve_table_name/1andrepo/1, which always raised (and were silently swallowed) at runtime. They now useDsl.table/1/Dsl.repo/1directly.
Improvements
- Relationship aggregates are now batched.
attach_aggregates/5issues one grouped query per aggregate across the whole result set (instead of one query per record × aggregate), turning an N×M round-trip pattern into M round-trips.has_many/has_onerelationship aggregates are now supported (previously onlybelongs_toworked; all others silently returneddefault_value). - Consistent, type-aware aggregate decoding.
decode_aggregate/2becamedecode_aggregate/4, which resolves the actual Ash attribute type of the aggregated field instead of sniffing the string's shape. This fixesDecimalcolumns being silently downgraded tofloatand mishandled scientific notation, and makes query-level and relationship aggregates return the same decoded type. raise_on_untranslatable_filternow defaults totrue(fail-closed). An untranslatable filter on abase_filter(tenant scoping, soft-delete) is now raised rather than silently dropped, avoiding queries that are less restrictive than intended. Opt back into the old warning-only behaviour withconfig :ash_clickhouse, :raise_on_untranslatable_filter, false.- Repo cache can now be cleared via
AshClickhouse.DataLayer.clear_repo_cache!/0for test suites that redefine resources between tests. - Connection errors now log the message and stacktrace before being
swallowed as
{:error, _}, andConnection.stop/1logs a debug message on shutdown instead of silently masking failures. truncate_integer/1renamed tovalidate_integer!/1to reflect that it validates/parses rather than truncates.- Documented the intentional difference between strict
sanitize!/1(table/database names) andquote_name/1(column identifiers), and marked the unusedgroup_byquery field as dead scaffolding.
0.1.0
- Initial release of AshClickhouse, an Ash data layer for ClickHouse.
- Implements
Ash.DataLayerwith CRUD, filter, sort, limit/offset, select, distinct, bulk_create, update_query/destroy_query, native aggregates, multitenancy, calculations, and relationship aggregates. - Provides the
clickhouseDSL,AshClickhouse.Repo,AshClickhouse.Connection, andmix ash_clickhouse.setup/mix ash_clickhouse.migratetasks.