ExArrow.ADBC.Database (ex_arrow v0.4.0)

View Source

ADBC Database handle: open a database via driver (shared library / env).

Canonical API from adbc.h: Database -> Connection -> Statement -> Arrow stream. Delegates to the configured implementation (see :adbc_database_impl in application config).

Summary

Functions

Closes a database handle.

Opens a database using the given driver path or options.

Types

t()

@opaque t()

Functions

close(database)

@spec close(t()) :: :ok

Closes a database handle.

The underlying NIF resource is freed automatically when all Elixir references are garbage-collected. Calling close/1 explicitly removes the Elixir reference held by the struct, allowing the driver to be reclaimed sooner.

open(driver_path_or_opts)

@spec open(String.t() | keyword() | :adbc_package) :: {:ok, t()} | {:error, term()}

Opens a database using the given driver path or options.

  • :adbc_package — use the supervised adbc-package connection when config :ex_arrow, :adbc_package is set (e.g. [driver: :sqlite, uri: ":memory:"]). The adbc Database and Connection are started under ExArrow’s supervisor; no native driver is loaded.
  • String — path to the driver shared library (e.g. libadbc_driver_sqlite.so).
  • Keyword listdriver_path: path, or driver_name: name with optional uri: uri. With driver_name, the driver manager looks up the library by name (e.g. env, system paths). If uri is provided, it is passed to the driver as the database URI (e.g. SQLite uri: ":memory:"). If uri is omitted, no URI option is set; drivers that require one may fail later at connection open.

Returns {:error, message} if the driver cannot be loaded or the adbc_package backend is not configured.