Elffuss BraidHub

kikocis/lancedb public

main · 6.9 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- [withMiddleware](LocalConnection.md#withmiddleware)
34
35## Constructors
36
37### constructor
38
39• **new LocalConnection**(`db`, `options`)
40
41#### Parameters
42
43| Name | Type |
44| :------ | :------ |
45| `db` | `any` |
46| `options` | [`ConnectionOptions`](../interfaces/ConnectionOptions.md) |
47
48#### Defined in
49
50[index.ts:739](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L739)
51
52## Properties
53
54### \_db
55
56• `Private` `Readonly` **\_db**: `any`
57
58#### Defined in
59
60[index.ts:737](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L737)
61
62___
63
64### \_options
65
66• `Private` `Readonly` **\_options**: () => [`ConnectionOptions`](../interfaces/ConnectionOptions.md)
67
68#### Type declaration
69
70▸ (): [`ConnectionOptions`](../interfaces/ConnectionOptions.md)
71
72##### Returns
73
74[`ConnectionOptions`](../interfaces/ConnectionOptions.md)
75
76#### Defined in
77
78[index.ts:736](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L736)
79
80## Accessors
81
82### uri
83
84• `get` **uri**(): `string`
85
86#### Returns
87
88`string`
89
90#### Implementation of
91
92[Connection](../interfaces/Connection.md).[uri](../interfaces/Connection.md#uri)
93
94#### Defined in
95
96[index.ts:744](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L744)
97
98## Methods
99
100### createTable
101
102▸ **createTable**\<`T`\>(`name`, `data?`, `optsOrEmbedding?`, `opt?`): `Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
103
104Creates a new Table, optionally initializing it with new data.
105
106#### Type parameters
107
108| Name |
109| :------ |
110| `T` |
111
112#### Parameters
113
114| Name | Type |
115| :------ | :------ |
116| `name` | `string` \| [`CreateTableOptions`](../interfaces/CreateTableOptions.md)\<`T`\> |
117| `data?` | `Table`\<`any`\> \| `Record`\<`string`, `unknown`\>[] |
118| `optsOrEmbedding?` | [`WriteOptions`](../interfaces/WriteOptions.md) \| [`EmbeddingFunction`](../interfaces/EmbeddingFunction.md)\<`T`\> |
119| `opt?` | [`WriteOptions`](../interfaces/WriteOptions.md) |
120
121#### Returns
122
123`Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
124
125#### Implementation of
126
127[Connection](../interfaces/Connection.md).[createTable](../interfaces/Connection.md#createtable)
128
129#### Defined in
130
131[index.ts:788](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L788)
132
133___
134
135### createTableImpl
136
137▸ `Private` **createTableImpl**\<`T`\>(`«destructured»`): `Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
138
139#### Type parameters
140
141| Name |
142| :------ |
143| `T` |
144
145#### Parameters
146
147| Name | Type |
148| :------ | :------ |
149| `«destructured»` | `Object` |
150| › `data?` | `Table`\<`any`\> \| `Record`\<`string`, `unknown`\>[] |
151| › `embeddingFunction?` | [`EmbeddingFunction`](../interfaces/EmbeddingFunction.md)\<`T`\> |
152| › `name` | `string` |
153| › `schema?` | `Schema`\<`any`\> |
154| › `writeOptions?` | [`WriteOptions`](../interfaces/WriteOptions.md) |
155
156#### Returns
157
158`Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
159
160#### Defined in
161
162[index.ts:822](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L822)
163
164___
165
166### dropTable
167
168▸ **dropTable**(`name`): `Promise`\<`void`\>
169
170Drop an existing table.
171
172#### Parameters
173
174| Name | Type | Description |
175| :------ | :------ | :------ |
176| `name` | `string` | The name of the table to drop. |
177
178#### Returns
179
180`Promise`\<`void`\>
181
182#### Implementation of
183
184[Connection](../interfaces/Connection.md).[dropTable](../interfaces/Connection.md#droptable)
185
186#### Defined in
187
188[index.ts:876](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L876)
189
190___
191
192### openTable
193
194▸ **openTable**(`name`): `Promise`\<[`Table`](../interfaces/Table.md)\<`number`[]\>\>
195
196Open a table in the database.
197
198#### Parameters
199
200| Name | Type | Description |
201| :------ | :------ | :------ |
202| `name` | `string` | The name of the table. |
203
204#### Returns
205
206`Promise`\<[`Table`](../interfaces/Table.md)\<`number`[]\>\>
207
208#### Implementation of
209
210[Connection](../interfaces/Connection.md).[openTable](../interfaces/Connection.md#opentable)
211
212#### Defined in
213
214[index.ts:760](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L760)
215
216▸ **openTable**\<`T`\>(`name`, `embeddings`): `Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
217
218Open a table in the database.
219
220#### Type parameters
221
222| Name |
223| :------ |
224| `T` |
225
226#### Parameters
227
228| Name | Type | Description |
229| :------ | :------ | :------ |
230| `name` | `string` | The name of the table. |
231| `embeddings` | [`EmbeddingFunction`](../interfaces/EmbeddingFunction.md)\<`T`\> | An embedding function to use on this Table |
232
233#### Returns
234
235`Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
236
237#### Implementation of
238
239Connection.openTable
240
241#### Defined in
242
243[index.ts:768](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L768)
244
245▸ **openTable**\<`T`\>(`name`, `embeddings?`): `Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
246
247#### Type parameters
248
249| Name |
250| :------ |
251| `T` |
252
253#### Parameters
254
255| Name | Type |
256| :------ | :------ |
257| `name` | `string` |
258| `embeddings?` | [`EmbeddingFunction`](../interfaces/EmbeddingFunction.md)\<`T`\> |
259
260#### Returns
261
262`Promise`\<[`Table`](../interfaces/Table.md)\<`T`\>\>
263
264#### Implementation of
265
266Connection.openTable
267
268#### Defined in
269
270[index.ts:772](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L772)
271
272___
273
274### tableNames
275
276▸ **tableNames**(): `Promise`\<`string`[]\>
277
278Get the names of all tables in the database.
279
280#### Returns
281
282`Promise`\<`string`[]\>
283
284#### Implementation of
285
286[Connection](../interfaces/Connection.md).[tableNames](../interfaces/Connection.md#tablenames)
287
288#### Defined in
289
290[index.ts:751](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L751)
291
292___
293
294### withMiddleware
295
296▸ **withMiddleware**(`middleware`): [`Connection`](../interfaces/Connection.md)
297
298Instrument the behavior of this Connection with middleware.
299
300The middleware will be called in the order they are added.
301
302Currently this functionality is only supported for remote Connections.
303
304#### Parameters
305
306| Name | Type |
307| :------ | :------ |
308| `middleware` | `HttpMiddleware` |
309
310#### Returns
311
312[`Connection`](../interfaces/Connection.md)
313
314- this Connection instrumented by the passed middleware
315
316#### Implementation of
317
318[Connection](../interfaces/Connection.md).[withMiddleware](../interfaces/Connection.md#withmiddleware)
319
320#### Defined in
321
322[index.ts:880](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L880)