ExArrow.ADBC.Connection (ex_arrow v0.4.0)

View Source

ADBC Connection: open from Database, then create Statements. Delegates to the configured implementation (see :adbc_connection_impl in application config).

Metadata APIs (get_table_types, get_table_schema, get_objects) are supported only when the driver implements them; otherwise they return {:error, message}.

Summary

Functions

Closes a connection handle.

Returns a hierarchical view of catalogs, schemas, tables, and/or columns.

Returns the Arrow schema of the given table. catalog and db_schema may be nil if not applicable for the driver. Not all drivers support this.

Returns a stream of table types (e.g. TABLE, VIEW) from the database. Not all drivers support this; returns {:error, message} if unsupported.

Opens a connection from a database handle.

Types

t()

@opaque t()

Functions

close(connection)

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

Closes a connection handle.

The underlying NIF resource is freed when all Elixir references are GC'd. Calling close/1 explicitly releases the struct reference so the connection can be reclaimed sooner (e.g. when returning it to a pool).

get_objects(conn, opts \\ [])

@spec get_objects(
  t(),
  keyword()
) :: {:ok, ExArrow.Stream.t()} | {:error, term()}

Returns a hierarchical view of catalogs, schemas, tables, and/or columns.

Options (all optional):

  • :depth"all", "catalogs", "schemas", "tables", or "columns" (default "all").
  • :catalog, :db_schema, :table_name, :column_name — filter by name (nil = no filter).

Not all drivers support this; returns {:error, message} if unsupported.

get_table_schema(conn, catalog, db_schema, table_name)

@spec get_table_schema(t(), String.t() | nil, String.t() | nil, String.t()) ::
  {:ok, ExArrow.Schema.t()} | {:error, term()}

Returns the Arrow schema of the given table. catalog and db_schema may be nil if not applicable for the driver. Not all drivers support this.

get_table_types(conn)

@spec get_table_types(t()) :: {:ok, ExArrow.Stream.t()} | {:error, term()}

Returns a stream of table types (e.g. TABLE, VIEW) from the database. Not all drivers support this; returns {:error, message} if unsupported.

open(database)

@spec open(ExArrow.ADBC.Database.t()) :: {:ok, t()} | {:error, term()}

Opens a connection from a database handle.