Adbc.Result (adbc v0.9.0)

Copy Markdown View Source

A struct returned as result from queries.

It has two fields:

  • :data - a list of Adbc.Column. The Adbc.Column may not yet have been materialized

  • :num_rows - the number of rows returned, if returned by the database

Summary

Functions

Consumes Arrow data from a Python object that implements the ArrowStream Export interface.

materialize/1 converts the result set's data from reference type to regular Elixir terms.

Returns a map of columns as a result.

Types

t()

@type t() :: %Adbc.Result{data: [Adbc.Column.t()], num_rows: non_neg_integer() | nil}

Functions

from_py(py_object)

Consumes Arrow data from a Python object that implements the ArrowStream Export interface.

The interface is typically implemented for dataframe objects, including ones from Pandas and Polars.

It returns an ok-tuple with Adbc.Result or an error-tuple. You often want to call Adbc.Result.materialize/1 or Adbc.Result.to_map/1 on the results to consume it.

materialize(result)

@spec materialize(
  %Adbc.Result{data: term(), num_rows: term()}
  | {:ok, %Adbc.Result{data: term(), num_rows: term()}}
  | {:error, String.t()}
) ::
  %Adbc.Result{data: term(), num_rows: term()}
  | {:ok, %Adbc.Result{data: term(), num_rows: term()}}
  | {:error, String.t()}

materialize/1 converts the result set's data from reference type to regular Elixir terms.

to_map(result)

Returns a map of columns as a result.