ADBC JavaScript Driver Manager
    Preparing search index...

    Class AdbcConnection

    Represents a single connection to a database.

    Implements

    Indexable

    • [key: number]: () => Promise<void>
    Index

    Methods

    • Set an option on the connection.

      Parameters

      • key: string

        The option name (e.g., "adbc.connection.autocommit").

      • value: string

        The option value.

      Returns void

    • Toggle read-only mode.

      Parameters

      • enabled: boolean

        Whether the connection should be read-only.

      Returns void

    • Get a hierarchical view of database objects (catalogs, schemas, tables, columns).

      Parameters

      Returns Promise<Table<any>>

      A Promise resolving to an Apache Arrow Table containing the metadata.

    • Get the Arrow schema for a specific table.

      Parameters

      • options: { catalog?: string; dbSchema?: string; tableName: string }

        An object containing catalog, dbSchema, and tableName.

        • Optionalcatalog?: string

          The catalog name (or undefined).

        • OptionaldbSchema?: string

          The schema name (or undefined).

        • tableName: string

          The table name.

      Returns Promise<Schema<any>>

      A Promise resolving to the Arrow Schema of the table.

    • Get a list of table types supported by the database.

      Returns Promise<Table<any>>

      A Promise resolving to an Apache Arrow Table with a single string column of table types.

    • Get metadata about the driver and database.

      Parameters

      • OptionalinfoCodes: InfoCode[]

        Optional list of info codes to retrieve. Use the InfoCode constants. If omitted, all available info is returned.

      Returns Promise<Table<any>>

      A Promise resolving to an Apache Arrow Table containing the requested metadata info.

    • Execute a SQL query and return all results as an Arrow Table.

      Convenience method that creates a statement, sets the SQL, optionally binds parameters, executes the query, and closes the statement. For large result sets, use queryStream to avoid loading everything into memory.

      Parameters

      • sql: string

        The SQL query to execute.

      • Optionalparams: Table<any>

        Optional Arrow Table to bind as parameters.

      Returns Promise<Table<any>>

      A Promise resolving to an Apache Arrow Table.

    • Execute a SQL query and return the results as a RecordBatchReader for streaming.

      Use this instead of query when working with large result sets that should not be fully loaded into memory. The reader remains valid after the statement is closed because the underlying iterator holds its own reference to the native resources.

      Parameters

      • sql: string

        The SQL query to execute.

      • Optionalparams: Table<any>

        Optional Arrow Table to bind as parameters.

      Returns Promise<RecordBatchReader<any>>

      A Promise resolving to an Apache Arrow RecordBatchReader.

    • Ingest Arrow data into a database table.

      Convenience method that sets the ingestion options, binds the data, and calls executeUpdate. Depending on the driver, this can avoid per-row overhead compared to a prepare-bind-insert loop.

      Parameters

      • tableName: string

        The target table name.

      • data: Table

        Arrow Table to ingest.

      • Optionaloptions: IngestOptions

        Ingestion options (mode, catalog, dbSchema, temporary).

      Returns Promise<number>

      A Promise resolving to the number of rows ingested, or -1 if unknown.

    • Ingest Arrow data from a stream into a database table.

      Unlike ingest, this method streams data batch-by-batch, avoiding full materialization in memory. Use this for large datasets that should not be buffered entirely.

      Parameters

      • tableName: string

        The target table name.

      • reader: RecordBatchReader

        Arrow RecordBatchReader to stream.

      • Optionaloptions: IngestOptions

        Ingestion options (mode, catalog, dbSchema, temporary).

      Returns Promise<number>

      A Promise resolving to the number of rows ingested, or -1 if unknown.

    • Execute a SQL statement (INSERT, UPDATE, DELETE, DDL) and return the row count.

      Convenience method that creates a statement, sets the SQL, optionally binds parameters, executes the update, and closes the statement.

      Parameters

      • sql: string

        The SQL statement to execute.

      • Optionalparams: Table<any>

        Optional Arrow Table to bind as parameters.

      Returns Promise<number>

      A Promise resolving to the number of rows affected, or -1 if unknown.

    • Commit any pending transactions. Only valid if autocommit is disabled.

      Returns Promise<void>