ExArrow.ADBC.Statement
(ex_arrow v0.4.0)
View Source
ADBC Statement: create with new(conn, sql) or new(conn, sql, bind: batch), then execute to get an Arrow stream (record batches).
Use set_sql/2 and bind/2 when reusing a statement. Delegates to the configured implementation (see :adbc_statement_impl in application config).
Summary
Functions
Binds a record batch to the statement (e.g. for prepared statements or bulk insert).
Not all drivers support binding; returns {:error, message} if unsupported.
Executes the statement and returns a stream of record batches.
Use ExArrow.Stream.schema/1 and ExArrow.Stream.next/1 to read the result.
Creates a new statement from a connection.
Sets the SQL for this statement (e.g. when creating with new/1 for reuse).
Types
Functions
@spec bind(t(), ExArrow.RecordBatch.t()) :: :ok | {:error, term()}
Binds a record batch to the statement (e.g. for prepared statements or bulk insert).
Not all drivers support binding; returns {:error, message} if unsupported.
@spec execute(t()) :: {:ok, ExArrow.Stream.t()} | {:error, term()}
Executes the statement and returns a stream of record batches.
Use ExArrow.Stream.schema/1 and ExArrow.Stream.next/1 to read the result.
@spec new(ExArrow.ADBC.Connection.t()) :: {:ok, t()} | {:error, term()}
Creates a new statement from a connection.
Optionally pass SQL and/or an initial bind as a record batch:
{:ok, stmt} = Statement.new(conn, "SELECT 1 AS n")
{:ok, stmt} = Statement.new(conn, "INSERT INTO t SELECT * FROM ?", bind: record_batch)Use bind/2 to rebind after creation.
@spec new(ExArrow.ADBC.Connection.t(), String.t()) :: {:ok, t()} | {:error, term()}
@spec new(ExArrow.ADBC.Connection.t(), String.t(), keyword()) :: {:ok, t()} | {:error, term()}
Sets the SQL for this statement (e.g. when creating with new/1 for reuse).