Installation & Setup
View SourceDuckdbEx runs the DuckDB CLI via erlexec. Install the CLI first, then add the
Hex dependency.
DuckDB CLI
You can install DuckDB in two ways:
- Run the built-in installer to download the CLI into your project’s
priv/duckdb/duckdb(orpriv/duckdb/duckdb.exeon Windows). This path is ignored by git:
mix duckdb_ex.install
Optional version pinning:
mix duckdb_ex.install --version 1.4.3
- Or install DuckDB from the official releases or your package manager, then
ensure the
duckdbbinary is on your PATH.
In both cases you can set DUCKDB_PATH to the full path of the binary.
Example (shell):
export DUCKDB_PATH="/usr/local/bin/duckdb"
If you need to run the CLI as root (some container environments), set:
export DUCKDB_EX_EXEC_AS_ROOT=1
Add Dependency
def deps do
[
{:duckdb_ex, "~> 0.2.0"}
]
endVerify
{:ok, _conn} = DuckdbEx.execute("SELECT 1")
{:ok, rows} = DuckdbEx.fetchall()
# rows == [{1}]