DuckDB analytical expression helpers for Ecto queries.
These macros wrap DuckDB-specific SQL functions in Ecto.Query.API.fragment/1
so analytical queries can stay in Ecto's query DSL instead of scattering raw
fragment strings across application code.
import Ecto.Query
import QuackDB.Ecto.Analytics
from(event in "events",
group_by: event.category,
select: %{
category: event.category,
median_score: median(event.score),
p95_score: quantile_cont(event.score, 0.95),
scores: list(event.score)
}
)Helpers only build expressions. DuckDB clauses that are not representable in
Ecto's AST, such as PIVOT, UNPIVOT, QUALIFY, and GROUPING SETS,
should still be sent as raw SQL.
Summary
Functions
Runs DuckDB SUMMARIZE for an Ecto queryable using the :all query operation.
Runs DuckDB SUMMARIZE for an Ecto queryable using the given Ecto SQL operation.
Runs DuckDB SUMMARIZE for an Ecto queryable and raises on error.
Runs DuckDB SUMMARIZE for an Ecto queryable using the given Ecto SQL operation and raises on error.
Functions
Runs DuckDB SUMMARIZE for an Ecto queryable using the :all query operation.
Runs DuckDB SUMMARIZE for an Ecto queryable using the given Ecto SQL operation.
Runs DuckDB SUMMARIZE for an Ecto queryable and raises on error.
Runs DuckDB SUMMARIZE for an Ecto queryable using the given Ecto SQL operation and raises on error.