Insert data from an Arrow IPC stream buffer into a table.
Creates a new table with the given name from the Arrow IPC data. If the table
already exists, the call is a no-op (uses CREATE TABLE IF NOT EXISTS).
Important: The IPC stream must not contain dictionary-encoded columns.
Flechette's tableFromArrays() defaults to dictionary(utf8()) for string
columns. Use explicit utf8() types to avoid this:
The name of the table to create
Arrow IPC stream bytes (use tableToIPC(table, { format: 'stream' }))
DuckDBError If the connection is closed or the IPC data is invalid
import { tableFromArrays, tableToIPC, utf8 } from '@ducklings/workers';
const table = tableFromArrays(
{ id: [1, 2, 3], name: ['Alice', 'Bob', 'Charlie'] },
{ types: { name: utf8() } } // Required for string columns
);
const ipcBuffer = tableToIPC(table, { format: 'stream' });
await conn.insertArrowFromIPCStream('users', ipcBuffer);
Executes a SQL statement without returning results.
The SQL statement to execute
Promise resolving to number of rows affected
Creates a prepared statement for the given SQL.
The SQL statement to prepare (use ? for parameters)
A PreparedStatement instance
Executes a SQL query and returns the results. This is async to support httpfs in Cloudflare Workers.
The SQL query to execute
Promise resolving to array of result rows as objects
Executes a SQL query and returns results as an Arrow table.
The SQL query to execute
Promise resolving to Arrow Table
A connection to a DuckDB database (async API for Cloudflare Workers).
All query methods in this class are async and return Promises.