7.6 KiB
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
Properties
_db
• Private Readonly _db: any
Defined in
_options
• Private Readonly _options: ConnectionOptions
Defined in
Accessors
uri
• get uri(): string
Returns
string
Implementation of
Defined in
Methods
createTable
▸ createTable(name, data, mode?): Promise<Table<number[]>>
Creates a new Table and initialize it with new data.
Parameters
| Name | Type | Description |
|---|---|---|
name |
string |
The name of the table. |
data |
Record<string, unknown>[] |
Non-empty Array of Records to be inserted into the Table |
mode? |
WriteMode |
The write mode to use when creating the table. |
Returns
Promise<Table<number[]>>
Implementation of
Defined in
▸ createTable(name, data, mode): Promise<Table<number[]>>
Parameters
| Name | Type |
|---|---|
name |
string |
data |
Record<string, unknown>[] |
mode |
WriteMode |
Returns
Promise<Table<number[]>>
Implementation of
Connection.createTable
Defined in
▸ createTable<T>(name, data, mode, embeddings): Promise<Table<T>>
Creates a new Table and initialize it with new data.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
name |
string |
The name of the table. |
data |
Record<string, unknown>[] |
Non-empty Array of Records to be inserted into the Table |
mode |
WriteMode |
The write mode to use when creating the table. |
embeddings |
EmbeddingFunction<T> |
An embedding function to use on this Table |
Returns
Promise<Table<T>>
Implementation of
Connection.createTable
Defined in
▸ createTable<T>(name, data, mode, embeddings?): Promise<Table<T>>
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
name |
string |
data |
Record<string, unknown>[] |
mode |
WriteMode |
embeddings? |
EmbeddingFunction<T> |
Returns
Promise<Table<T>>
Implementation of
Connection.createTable
Defined in
createTableArrow
▸ createTableArrow(name, table): Promise<Table<number[]>>
Parameters
| Name | Type |
|---|---|
name |
string |
table |
Table<any> |
Returns
Promise<Table<number[]>>
Implementation of
Defined in
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
Defined in
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
Defined in
▸ 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
▸ 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
tableNames
▸ tableNames(): Promise<string[]>
Get the names of all tables in the database.
Returns
Promise<string[]>