The examples directory shows QuackDB as an Elixir-native bridge to DuckDB analytics.
Examples start a local DuckDB Quack server with QuackDB.Server unless QUACKDB_URI is set. This keeps the examples runnable without asking you to manually start DuckDB.
Query observability
examples/query_observability.exs attaches telemetry handlers and prints query, append, and fetch timings.
cd /tmp
elixir /path/to/quackdb/examples/query_observability.exs
Source sampling
examples/source_sampling.exs scans newline-delimited JSON with QuackDB.Source, wraps it in USING SAMPLE, queries it through Ecto, and profiles the sampled source with DuckDB SUMMARIZE.
cd /tmp
elixir /path/to/quackdb/examples/source_sampling.exs
Dataframe analytics
examples/dataframe_analytics.exs demonstrates:
- deriving DuckDB DDL from an Ecto schema
- appending an
Explorer.DataFramethrough native column append - querying with Ecto DSL
- returning an Explorer dataframe
cd /tmp
elixir /path/to/quackdb/examples/dataframe_analytics.exs
Append benchmark
examples/append_benchmark.exs compares SQL inserts, native row/column append, Explorer dataframe append, and Ecto insert paths.
cd /tmp
SMOKE=1 ROWS=10 BATCH_SIZE=5 elixir /path/to/quackdb/examples/append_benchmark.exs
Remove SMOKE=1 and increase ROWS for benchmark runs.
Full-text search
examples/full_text_search.exs creates a DuckDB FTS index, runs direct SQL BM25 search, and runs the same search through Ecto fragments.
cd /tmp
elixir /path/to/quackdb/examples/full_text_search.exs
Livebook analytics
examples/livebook_analytics.livemd is an interactive notebook using Explorer, Table.Reader, VegaLite, telemetry, and a local QuackDB.Server.
Spatial WMS
examples/spatial_wms/ is a minimal Ash + Ecto + Plug/Bandit application serving DuckDB Spatial rows through a WMS-like GeoJSON endpoint.
cd examples/spatial_wms
mix run --no-halt
Existing servers
To use an existing DuckDB Quack server instead of QuackDB.Server, set:
QUACKDB_URI='http://[::1]:9494'
QUACKDB_TOKEN=super_secret