Elffuss BraidHub

kikocis/lancedb public

85830ec79fd2 · 6.1 KiBRenderedRawPermalink
1[vectordb](../README.md) / [Exports](../modules.md) / LocalConnection
2
3# Class: LocalConnection
4
5A connection to a LanceDB database.
6
7## Implements
8
9- [`Connection`](../interfaces/Connection.md)
10
11## Table of contents
12
13### Constructors
14
15- [constructor](LocalConnection.md#constructor)
16
17### Properties
18
19- [\_db](LocalConnection.md#_db)
20- [\_options](LocalConnection.md#_options)
21
22### Accessors
23
24- [uri](LocalConnection.md#uri)
25
26### Methods
27
28- [createTable](LocalConnection.md#createtable)
29- [createTableImpl](LocalConnection.md#createtableimpl)
30- [dropTable](LocalConnection.md#droptable)
31- [openTable](LocalConnection.md#opentable)
32- [tableNames](LocalConnection.md#tablenames)
33
34## Constructors
35
36### constructor
37
38• **new LocalConnection**(`db`, `options`)
39
40#### Parameters
41
42| Name | Type |
43| :------ | :------ |
44| `db` | `any` |
45| `options` | [`ConnectionOptions`](../interfaces/ConnectionOptions.md) |
46
47#### Defined in
48
49[index.ts:489](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L489)
50
51## Properties
52
53### \_db
54
55• `Private` `Readonly` **\_db**: `any`
56
57#### Defined in
58
59[index.ts:487](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L487)
60
61___
62
63### \_options
64
65• `Private` `Readonly` **\_options**: () => [`ConnectionOptions`](../interfaces/ConnectionOptions.md)
66
67#### Type declaration
68
69▸ (): [`ConnectionOptions`](../interfaces/ConnectionOptions.md)
70
71##### Returns
72
73[`ConnectionOptions`](../interfaces/ConnectionOptions.md)
74
75#### Defined in
76
77[index.ts:486](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L486)
78
79## Accessors
80
81### uri
82
83• `get` **uri**(): `string`
84
85#### Returns
86
87`string`
88
89#### Implementation of
90
91[Connection](../interfaces/Connection.md).[uri](../interfaces/Connection.md#uri)
92
93#### Defined in
94
95[index.ts:494](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L494)
96
97## Methods
98
99### createTable
100
101▸ **createTable**\<`T`\>(`name`, `data?`, `optsOrEmbedding?`, `opt?`): `Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
102
103Creates a new Table, optionally initializing it with new data.
104
105#### Type parameters
106
107| Name |
108| :------ |
109| `T` |
110
111#### Parameters
112
113| Name | Type |
114| :------ | :------ |
115| `name` | `string` \| [`CreateTableOptions`](../interfaces/CreateTableOptions.md)\<`T`\> |
116| `data?` | `Record`\<`string`, `unknown`\>[] |
117| `optsOrEmbedding?` | [`WriteOptions`](../interfaces/WriteOptions.md) \| [`EmbeddingFunction`](../interfaces/EmbeddingFunction.md)\<`T`\> |
118| `opt?` | [`WriteOptions`](../interfaces/WriteOptions.md) |
119
120#### Returns
121
122`Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
123
124#### Implementation of
125
126[Connection](../interfaces/Connection.md).[createTable](../interfaces/Connection.md#createtable)
127
128#### Defined in
129
130[index.ts:542](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L542)
131
132___
133
134### createTableImpl
135
136▸ `Private` **createTableImpl**\<`T`\>(`«destructured»`): `Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
137
138#### Type parameters
139
140| Name |
141| :------ |
142| `T` |
143
144#### Parameters
145
146| Name | Type |
147| :------ | :------ |
148| `«destructured»` | `Object` |
149| › `data?` | `Table`\<`any`\> \| `Record`\<`string`, `unknown`\>[] |
150| › `embeddingFunction?` | [`EmbeddingFunction`](../interfaces/EmbeddingFunction.md)\<`T`\> |
151| › `name` | `string` |
152| › `schema?` | `Schema`\<`any`\> |
153| › `writeOptions?` | [`WriteOptions`](../interfaces/WriteOptions.md) |
154
155#### Returns
156
157`Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
158
159#### Defined in
160
161[index.ts:576](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L576)
162
163___
164
165### dropTable
166
167▸ **dropTable**(`name`): `Promise`\<`void`\>
168
169Drop an existing table.
170
171#### Parameters
172
173| Name | Type | Description |
174| :------ | :------ | :------ |
175| `name` | `string` | The name of the table to drop. |
176
177#### Returns
178
179`Promise`\<`void`\>
180
181#### Implementation of
182
183[Connection](../interfaces/Connection.md).[dropTable](../interfaces/Connection.md#droptable)
184
185#### Defined in
186
187[index.ts:630](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L630)
188
189___
190
191### openTable
192
193▸ **openTable**(`name`): `Promise`\<[`Table`](../interfaces/Table.md)\<`number`[]\>\>
194
195Open a table in the database.
196
197#### Parameters
198
199| Name | Type | Description |
200| :------ | :------ | :------ |
201| `name` | `string` | The name of the table. |
202
203#### Returns
204
205`Promise`\<[`Table`](../interfaces/Table.md)\<`number`[]\>\>
206
207#### Implementation of
208
209[Connection](../interfaces/Connection.md).[openTable](../interfaces/Connection.md#opentable)
210
211#### Defined in
212
213[index.ts:510](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L510)
214
215▸ **openTable**\<`T`\>(`name`, `embeddings`): `Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
216
217Open a table in the database.
218
219#### Type parameters
220
221| Name |
222| :------ |
223| `T` |
224
225#### Parameters
226
227| Name | Type | Description |
228| :------ | :------ | :------ |
229| `name` | `string` | The name of the table. |
230| `embeddings` | [`EmbeddingFunction`](../interfaces/EmbeddingFunction.md)\<`T`\> | An embedding function to use on this Table |
231
232#### Returns
233
234`Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
235
236#### Implementation of
237
238Connection.openTable
239
240#### Defined in
241
242[index.ts:518](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L518)
243
244▸ **openTable**\<`T`\>(`name`, `embeddings?`): `Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
245
246#### Type parameters
247
248| Name |
249| :------ |
250| `T` |
251
252#### Parameters
253
254| Name | Type |
255| :------ | :------ |
256| `name` | `string` |
257| `embeddings?` | [`EmbeddingFunction`](../interfaces/EmbeddingFunction.md)\<`T`\> |
258
259#### Returns
260
261`Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
262
263#### Implementation of
264
265Connection.openTable
266
267#### Defined in
268
269[index.ts:522](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L522)
270
271___
272
273### tableNames
274
275▸ **tableNames**(): `Promise`\<`string`[]\>
276
277Get the names of all tables in the database.
278
279#### Returns
280
281`Promise`\<`string`[]\>
282
283#### Implementation of
284
285[Connection](../interfaces/Connection.md).[tableNames](../interfaces/Connection.md#tablenames)
286
287#### Defined in
288
289[index.ts:501](https://github.com/lancedb/lancedb/blob/c89d5e6/node/src/index.ts#L501)