Files
lancedb/docs/src/javascript/classes/LocalTable.md
Will Jones ee0f0611d9 docs: update node API reference (#734)
This command hasn't been run for a while...
2023-12-22 10:14:31 -08:00

11 KiB

vectordb / Exports / LocalTable

Class: LocalTable<T>

A LanceDB Table is the collection of Records. Each Record has one or more vector fields.

Type parameters

Name Type
T number[]

Implements

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new LocalTable<T>(tbl, name, options)

Type parameters

Name Type
T number[]

Parameters

Name Type
tbl any
name string
options ConnectionOptions

Defined in

index.ts:464

new LocalTable<T>(tbl, name, options, embeddings)

Type parameters

Name Type
T number[]

Parameters

Name Type Description
tbl any
name string
options ConnectionOptions
embeddings EmbeddingFunction<T> An embedding function to use when interacting with this table

Defined in

index.ts:471

Properties

_embeddings

Private Optional Readonly _embeddings: EmbeddingFunction<T>

Defined in

index.ts:461


_name

Private Readonly _name: string

Defined in

index.ts:460


_options

Private Readonly _options: () => ConnectionOptions

Type declaration

▸ (): ConnectionOptions

Returns

ConnectionOptions

Defined in

index.ts:462


_tbl

Private _tbl: any

Defined in

index.ts:459


where

where: (value: string) => Query<T>

Type declaration

▸ (value): Query<T>

Creates a filter query to find all rows matching the specified criteria

Parameters
Name Type Description
value string The filter criteria (like SQL where clause syntax)
Returns

Query<T>

Defined in

index.ts:499

Accessors

name

get name(): string

Returns

string

Implementation of

Table.name

Defined in

index.ts:479

Methods

add

add(data): Promise<number>

Insert records into this Table.

Parameters

Name Type Description
data Record<string, unknown>[] Records to be inserted into the Table

Returns

Promise<number>

The number of rows added to the table

Implementation of

Table.add

Defined in

index.ts:507


cleanupOldVersions

cleanupOldVersions(olderThan?, deleteUnverified?): Promise<CleanupStats>

Clean up old versions of the table, freeing disk space.

Parameters

Name Type Description
olderThan? number The minimum age in minutes of the versions to delete. If not provided, defaults to two weeks.
deleteUnverified? boolean Because they may be part of an in-progress transaction, uncommitted files newer than 7 days old are not deleted by default. This means that failed transactions can leave around data that takes up disk space for up to 7 days. You can override this safety mechanism by setting this option to true, only if you promise there are no in progress writes while you run this operation. Failure to uphold this promise can lead to corrupted tables.

Returns

Promise<CleanupStats>

Defined in

index.ts:596


compactFiles

compactFiles(options?): Promise<CompactionMetrics>

Run the compaction process on the table.

This can be run after making several small appends to optimize the table for faster reads.

Parameters

Name Type Description
options? CompactionOptions Advanced options configuring compaction. In most cases, you can omit this arguments, as the default options are sensible for most tables.

Returns

Promise<CompactionMetrics>

Metrics about the compaction operation.

Defined in

index.ts:615


countRows

countRows(): Promise<number>

Returns the number of rows in this table.

Returns

Promise<number>

Implementation of

Table.countRows

Defined in

index.ts:543


createIndex

createIndex(indexParams): Promise<any>

Create an ANN index on this Table vector index.

Parameters

Name Type Description
indexParams IvfPQIndexConfig The parameters of this Index,

Returns

Promise<any>

See

VectorIndexParams.

Implementation of

Table.createIndex

Defined in

index.ts:536


delete

delete(filter): Promise<void>

Delete rows from this table.

Parameters

Name Type Description
filter string A filter in the same format used by a sql WHERE clause.

Returns

Promise<void>

Implementation of

Table.delete

Defined in

index.ts:552


filter

filter(value): Query<T>

Creates a filter query to find all rows matching the specified criteria

Parameters

Name Type Description
value string The filter criteria (like SQL where clause syntax)

Returns

Query<T>

Defined in

index.ts:495


indexStats

indexStats(indexUuid): Promise<IndexStats>

Get statistics about an index.

Parameters

Name Type
indexUuid string

Returns

Promise<IndexStats>

Implementation of

Table.indexStats

Defined in

index.ts:628


listIndices

listIndices(): Promise<VectorIndex[]>

List the indicies on this table.

Returns

Promise<VectorIndex[]>

Implementation of

Table.listIndices

Defined in

index.ts:624


overwrite

overwrite(data): Promise<number>

Insert records into this Table, replacing its contents.

Parameters

Name Type Description
data Record<string, unknown>[] Records to be inserted into the Table

Returns

Promise<number>

The number of rows added to the table

Implementation of

Table.overwrite

Defined in

index.ts:522


search(query): Query<T>

Creates a search query to find the nearest neighbors of the given search term

Parameters

Name Type Description
query T The query search term

Returns

Query<T>

Implementation of

Table.search

Defined in

index.ts:487


update

update(args): Promise<void>

Update rows in this table.

Parameters

Name Type Description
args UpdateArgs | UpdateSqlArgs see UpdateArgs and UpdateSqlArgs for more details

Returns

Promise<void>

Implementation of

Table.update

Defined in

index.ts:563