Skip to content

vectordb / Exports / LocalConnection

Class: LocalConnection

A connection to a LanceDB database.

Implements

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

โ€ข new LocalConnection(db, options)

Parameters

Name Type
db any
options ConnectionOptions

Defined in

index.ts:716

Properties

_db

โ€ข Private Readonly _db: any

Defined in

index.ts:714


_options

โ€ข Private Readonly _options: () => ConnectionOptions

Type declaration

โ–ธ (): ConnectionOptions

Returns

ConnectionOptions

Defined in

index.ts:713

Accessors

uri

โ€ข get uri(): string

Returns

string

Implementation of

Connection.uri

Defined in

index.ts:721

Methods

createTable

โ–ธ createTable\<T>(name, data?, optsOrEmbedding?, opt?): Promise\<Table\<T>>

Creates a new Table, optionally initializing it with new data.

Type parameters

Name
T

Parameters

Name Type
name string | CreateTableOptions\<T>
data? Table\<any> | Record\<string, unknown>[]
optsOrEmbedding? WriteOptions | EmbeddingFunction\<T>
opt? WriteOptions

Returns

Promise\<Table\<T>>

Implementation of

Connection.createTable

Defined in

index.ts:765


createTableImpl

โ–ธ Private createTableImpl\<T>(ยซdestructuredยป): Promise\<Table\<T>>

Type parameters

Name
T

Parameters

Name Type
ยซdestructuredยป Object
โ€บย data? Table\<any> | Record\<string, unknown>[]
โ€บย embeddingFunction? EmbeddingFunction\<T>
โ€บย name string
โ€บย schema? Schema\<any>
โ€บย writeOptions? WriteOptions

Returns

Promise\<Table\<T>>

Defined in

index.ts:799


dropTable

โ–ธ dropTable(name): Promise\<void>

Drop an existing table.

Parameters

Name Type Description
name string The name of the table to drop.

Returns

Promise\<void>

Implementation of

Connection.dropTable

Defined in

index.ts:853


openTable

โ–ธ openTable(name): Promise\<Table\<number[]>>

Open a table in the database.

Parameters

Name Type Description
name string The name of the table.

Returns

Promise\<Table\<number[]>>

Implementation of

Connection.openTable

Defined in

index.ts:737

โ–ธ openTable\<T>(name, embeddings): Promise\<Table\<T>>

Open a table in the database.

Type parameters

Name
T

Parameters

Name Type Description
name string The name of the table.
embeddings EmbeddingFunction\<T> An embedding function to use on this Table

Returns

Promise\<Table\<T>>

Implementation of

Connection.openTable

Defined in

index.ts:745

โ–ธ openTable\<T>(name, embeddings?): Promise\<Table\<T>>

Type parameters

Name
T

Parameters

Name Type
name string
embeddings? EmbeddingFunction\<T>

Returns

Promise\<Table\<T>>

Implementation of

Connection.openTable

Defined in

index.ts:749


tableNames

โ–ธ tableNames(): Promise\<string[]>

Get the names of all tables in the database.

Returns

Promise\<string[]>

Implementation of

Connection.tableNames

Defined in

index.ts:728


withMiddleware

โ–ธ withMiddleware(middleware): Connection

Instrument the behavior of this Connection with middleware.

The middleware will be called in the order they are added.

Currently this functionality is only supported for remote Connections.

Parameters

Name Type
middleware HttpMiddleware

Returns

Connection

  • this Connection instrumented by the passed middleware

Implementation of

Connection.withMiddleware

Defined in

index.ts:857