@lancedb/lancedb 0.4.18 → 0.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/table.d.ts +48 -42
- package/dist/table.js +48 -42
- package/lancedb/table.ts +48 -42
- package/nodejs-artifacts/table.d.ts +48 -42
- package/nodejs-artifacts/table.js +48 -42
- package/package.json +8 -7
package/dist/table.d.ts
CHANGED
|
@@ -104,17 +104,20 @@ export declare class Table {
|
|
|
104
104
|
* // If the column has a vector (fixed size list) data type then
|
|
105
105
|
* // an IvfPq vector index will be created.
|
|
106
106
|
* const table = await conn.openTable("my_table");
|
|
107
|
-
* await table.createIndex(
|
|
107
|
+
* await table.createIndex("vector");
|
|
108
108
|
* @example
|
|
109
109
|
* // For advanced control over vector index creation you can specify
|
|
110
110
|
* // the index type and options.
|
|
111
111
|
* const table = await conn.openTable("my_table");
|
|
112
|
-
* await table.createIndex(
|
|
113
|
-
* .
|
|
114
|
-
*
|
|
112
|
+
* await table.createIndex("vector", {
|
|
113
|
+
* config: lancedb.Index.ivfPq({
|
|
114
|
+
* numPartitions: 128,
|
|
115
|
+
* numSubVectors: 16,
|
|
116
|
+
* }),
|
|
117
|
+
* });
|
|
115
118
|
* @example
|
|
116
119
|
* // Or create a Scalar index
|
|
117
|
-
* await table.createIndex("my_float_col")
|
|
120
|
+
* await table.createIndex("my_float_col");
|
|
118
121
|
*/
|
|
119
122
|
createIndex(column: string, options?: Partial<IndexOptions>): Promise<void>;
|
|
120
123
|
/**
|
|
@@ -126,8 +129,7 @@ export declare class Table {
|
|
|
126
129
|
* vector similarity, sorting, and more.
|
|
127
130
|
*
|
|
128
131
|
* Note: By default, all columns are returned. For best performance, you should
|
|
129
|
-
* only fetch the columns you need.
|
|
130
|
-
* more details.
|
|
132
|
+
* only fetch the columns you need.
|
|
131
133
|
*
|
|
132
134
|
* When appropriate, various indices and statistics based pruning will be used to
|
|
133
135
|
* accelerate the query.
|
|
@@ -135,10 +137,13 @@ export declare class Table {
|
|
|
135
137
|
* // SQL-style filtering
|
|
136
138
|
* //
|
|
137
139
|
* // This query will return up to 1000 rows whose value in the `id` column
|
|
138
|
-
* // is greater than 5.
|
|
139
|
-
* for await (const batch of table
|
|
140
|
-
*
|
|
141
|
-
*
|
|
140
|
+
* // is greater than 5. LanceDb supports a broad set of filtering functions.
|
|
141
|
+
* for await (const batch of table
|
|
142
|
+
* .query()
|
|
143
|
+
* .where("id > 1")
|
|
144
|
+
* .select(["id"])
|
|
145
|
+
* .limit(20)) {
|
|
146
|
+
* console.log(batch);
|
|
142
147
|
* }
|
|
143
148
|
* @example
|
|
144
149
|
* // Vector Similarity Search
|
|
@@ -147,13 +152,14 @@ export declare class Table {
|
|
|
147
152
|
* // closest to the query vector [1.0, 2.0, 3.0]. If an index has been created
|
|
148
153
|
* // on the "vector" column then this will perform an ANN search.
|
|
149
154
|
* //
|
|
150
|
-
* // The `
|
|
155
|
+
* // The `refineFactor` and `nprobes` methods are used to control the recall /
|
|
151
156
|
* // latency tradeoff of the search.
|
|
152
|
-
* for await (const batch of table
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
+
* for await (const batch of table
|
|
158
|
+
* .query()
|
|
159
|
+
* .where("id > 1")
|
|
160
|
+
* .select(["id"])
|
|
161
|
+
* .limit(20)) {
|
|
162
|
+
* console.log(batch);
|
|
157
163
|
* }
|
|
158
164
|
* @example
|
|
159
165
|
* // Scan the full dataset
|
|
@@ -199,37 +205,39 @@ export declare class Table {
|
|
|
199
205
|
* (e.g. "a").
|
|
200
206
|
*/
|
|
201
207
|
dropColumns(columnNames: string[]): Promise<void>;
|
|
202
|
-
/**
|
|
203
|
-
* Retrieve the version of the table
|
|
204
|
-
*
|
|
205
|
-
* LanceDb supports versioning. Every operation that modifies the table increases
|
|
206
|
-
* version. As long as a version hasn't been deleted you can `[Self::checkout]` that
|
|
207
|
-
* version to view the data at that point. In addition, you can `[Self::restore]` the
|
|
208
|
-
* version to replace the current table with a previous version.
|
|
209
|
-
*/
|
|
208
|
+
/** Retrieve the version of the table */
|
|
210
209
|
version(): Promise<number>;
|
|
211
210
|
/**
|
|
212
|
-
* Checks out a specific version of the
|
|
211
|
+
* Checks out a specific version of the table _This is an in-place operation._
|
|
213
212
|
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
213
|
+
* This allows viewing previous versions of the table. If you wish to
|
|
214
|
+
* keep writing to the dataset starting from an old version, then use
|
|
215
|
+
* the `restore` function.
|
|
217
216
|
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
217
|
+
* Calling this method will set the table into time-travel mode. If you
|
|
218
|
+
* wish to return to standard mode, call `checkoutLatest`.
|
|
219
|
+
* @param {number} version The version to checkout
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* import * as lancedb from "@lancedb/lancedb"
|
|
223
|
+
* const db = await lancedb.connect("./.lancedb");
|
|
224
|
+
* const table = await db.createTable("my_table", [
|
|
225
|
+
* { vector: [1.1, 0.9], type: "vector" },
|
|
226
|
+
* ]);
|
|
224
227
|
*
|
|
225
|
-
*
|
|
228
|
+
* console.log(await table.version()); // 1
|
|
229
|
+
* console.log(table.display());
|
|
230
|
+
* await table.add([{ vector: [0.5, 0.2], type: "vector" }]);
|
|
231
|
+
* await table.checkout(1);
|
|
232
|
+
* console.log(await table.version()); // 2
|
|
233
|
+
* ```
|
|
226
234
|
*/
|
|
227
235
|
checkout(version: number): Promise<void>;
|
|
228
236
|
/**
|
|
229
|
-
*
|
|
237
|
+
* Checkout the latest version of the table. _This is an in-place operation._
|
|
230
238
|
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
239
|
+
* The table will be set back into standard mode, and will track the latest
|
|
240
|
+
* version of the table.
|
|
233
241
|
*/
|
|
234
242
|
checkoutLatest(): Promise<void>;
|
|
235
243
|
/**
|
|
@@ -245,8 +253,6 @@ export declare class Table {
|
|
|
245
253
|
* out state and the read_consistency_interval, if any, will apply.
|
|
246
254
|
*/
|
|
247
255
|
restore(): Promise<void>;
|
|
248
|
-
/**
|
|
249
|
-
* List all indices that have been created with Self::create_index
|
|
250
|
-
*/
|
|
256
|
+
/** List all indices that have been created with {@link Table.createIndex} */
|
|
251
257
|
listIndices(): Promise<IndexConfig[]>;
|
|
252
258
|
}
|
package/dist/table.js
CHANGED
|
@@ -123,17 +123,20 @@ class Table {
|
|
|
123
123
|
* // If the column has a vector (fixed size list) data type then
|
|
124
124
|
* // an IvfPq vector index will be created.
|
|
125
125
|
* const table = await conn.openTable("my_table");
|
|
126
|
-
* await table.createIndex(
|
|
126
|
+
* await table.createIndex("vector");
|
|
127
127
|
* @example
|
|
128
128
|
* // For advanced control over vector index creation you can specify
|
|
129
129
|
* // the index type and options.
|
|
130
130
|
* const table = await conn.openTable("my_table");
|
|
131
|
-
* await table.createIndex(
|
|
132
|
-
* .
|
|
133
|
-
*
|
|
131
|
+
* await table.createIndex("vector", {
|
|
132
|
+
* config: lancedb.Index.ivfPq({
|
|
133
|
+
* numPartitions: 128,
|
|
134
|
+
* numSubVectors: 16,
|
|
135
|
+
* }),
|
|
136
|
+
* });
|
|
134
137
|
* @example
|
|
135
138
|
* // Or create a Scalar index
|
|
136
|
-
* await table.createIndex("my_float_col")
|
|
139
|
+
* await table.createIndex("my_float_col");
|
|
137
140
|
*/
|
|
138
141
|
async createIndex(column, options) {
|
|
139
142
|
// Bit of a hack to get around the fact that TS has no package-scope.
|
|
@@ -150,8 +153,7 @@ class Table {
|
|
|
150
153
|
* vector similarity, sorting, and more.
|
|
151
154
|
*
|
|
152
155
|
* Note: By default, all columns are returned. For best performance, you should
|
|
153
|
-
* only fetch the columns you need.
|
|
154
|
-
* more details.
|
|
156
|
+
* only fetch the columns you need.
|
|
155
157
|
*
|
|
156
158
|
* When appropriate, various indices and statistics based pruning will be used to
|
|
157
159
|
* accelerate the query.
|
|
@@ -159,10 +161,13 @@ class Table {
|
|
|
159
161
|
* // SQL-style filtering
|
|
160
162
|
* //
|
|
161
163
|
* // This query will return up to 1000 rows whose value in the `id` column
|
|
162
|
-
* // is greater than 5.
|
|
163
|
-
* for await (const batch of table
|
|
164
|
-
*
|
|
165
|
-
*
|
|
164
|
+
* // is greater than 5. LanceDb supports a broad set of filtering functions.
|
|
165
|
+
* for await (const batch of table
|
|
166
|
+
* .query()
|
|
167
|
+
* .where("id > 1")
|
|
168
|
+
* .select(["id"])
|
|
169
|
+
* .limit(20)) {
|
|
170
|
+
* console.log(batch);
|
|
166
171
|
* }
|
|
167
172
|
* @example
|
|
168
173
|
* // Vector Similarity Search
|
|
@@ -171,13 +176,14 @@ class Table {
|
|
|
171
176
|
* // closest to the query vector [1.0, 2.0, 3.0]. If an index has been created
|
|
172
177
|
* // on the "vector" column then this will perform an ANN search.
|
|
173
178
|
* //
|
|
174
|
-
* // The `
|
|
179
|
+
* // The `refineFactor` and `nprobes` methods are used to control the recall /
|
|
175
180
|
* // latency tradeoff of the search.
|
|
176
|
-
* for await (const batch of table
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
+
* for await (const batch of table
|
|
182
|
+
* .query()
|
|
183
|
+
* .where("id > 1")
|
|
184
|
+
* .select(["id"])
|
|
185
|
+
* .limit(20)) {
|
|
186
|
+
* console.log(batch);
|
|
181
187
|
* }
|
|
182
188
|
* @example
|
|
183
189
|
* // Scan the full dataset
|
|
@@ -234,41 +240,43 @@ class Table {
|
|
|
234
240
|
async dropColumns(columnNames) {
|
|
235
241
|
await this.inner.dropColumns(columnNames);
|
|
236
242
|
}
|
|
237
|
-
/**
|
|
238
|
-
* Retrieve the version of the table
|
|
239
|
-
*
|
|
240
|
-
* LanceDb supports versioning. Every operation that modifies the table increases
|
|
241
|
-
* version. As long as a version hasn't been deleted you can `[Self::checkout]` that
|
|
242
|
-
* version to view the data at that point. In addition, you can `[Self::restore]` the
|
|
243
|
-
* version to replace the current table with a previous version.
|
|
244
|
-
*/
|
|
243
|
+
/** Retrieve the version of the table */
|
|
245
244
|
async version() {
|
|
246
245
|
return await this.inner.version();
|
|
247
246
|
}
|
|
248
247
|
/**
|
|
249
|
-
* Checks out a specific version of the
|
|
248
|
+
* Checks out a specific version of the table _This is an in-place operation._
|
|
250
249
|
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
250
|
+
* This allows viewing previous versions of the table. If you wish to
|
|
251
|
+
* keep writing to the dataset starting from an old version, then use
|
|
252
|
+
* the `restore` function.
|
|
254
253
|
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
254
|
+
* Calling this method will set the table into time-travel mode. If you
|
|
255
|
+
* wish to return to standard mode, call `checkoutLatest`.
|
|
256
|
+
* @param {number} version The version to checkout
|
|
257
|
+
* @example
|
|
258
|
+
* ```typescript
|
|
259
|
+
* import * as lancedb from "@lancedb/lancedb"
|
|
260
|
+
* const db = await lancedb.connect("./.lancedb");
|
|
261
|
+
* const table = await db.createTable("my_table", [
|
|
262
|
+
* { vector: [1.1, 0.9], type: "vector" },
|
|
263
|
+
* ]);
|
|
261
264
|
*
|
|
262
|
-
*
|
|
265
|
+
* console.log(await table.version()); // 1
|
|
266
|
+
* console.log(table.display());
|
|
267
|
+
* await table.add([{ vector: [0.5, 0.2], type: "vector" }]);
|
|
268
|
+
* await table.checkout(1);
|
|
269
|
+
* console.log(await table.version()); // 2
|
|
270
|
+
* ```
|
|
263
271
|
*/
|
|
264
272
|
async checkout(version) {
|
|
265
273
|
await this.inner.checkout(version);
|
|
266
274
|
}
|
|
267
275
|
/**
|
|
268
|
-
*
|
|
276
|
+
* Checkout the latest version of the table. _This is an in-place operation._
|
|
269
277
|
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
278
|
+
* The table will be set back into standard mode, and will track the latest
|
|
279
|
+
* version of the table.
|
|
272
280
|
*/
|
|
273
281
|
async checkoutLatest() {
|
|
274
282
|
await this.inner.checkoutLatest();
|
|
@@ -288,9 +296,7 @@ class Table {
|
|
|
288
296
|
async restore() {
|
|
289
297
|
await this.inner.restore();
|
|
290
298
|
}
|
|
291
|
-
/**
|
|
292
|
-
* List all indices that have been created with Self::create_index
|
|
293
|
-
*/
|
|
299
|
+
/** List all indices that have been created with {@link Table.createIndex} */
|
|
294
300
|
async listIndices() {
|
|
295
301
|
return await this.inner.listIndices();
|
|
296
302
|
}
|
package/lancedb/table.ts
CHANGED
|
@@ -169,17 +169,20 @@ export class Table {
|
|
|
169
169
|
* // If the column has a vector (fixed size list) data type then
|
|
170
170
|
* // an IvfPq vector index will be created.
|
|
171
171
|
* const table = await conn.openTable("my_table");
|
|
172
|
-
* await table.createIndex(
|
|
172
|
+
* await table.createIndex("vector");
|
|
173
173
|
* @example
|
|
174
174
|
* // For advanced control over vector index creation you can specify
|
|
175
175
|
* // the index type and options.
|
|
176
176
|
* const table = await conn.openTable("my_table");
|
|
177
|
-
* await table.createIndex(
|
|
178
|
-
* .
|
|
179
|
-
*
|
|
177
|
+
* await table.createIndex("vector", {
|
|
178
|
+
* config: lancedb.Index.ivfPq({
|
|
179
|
+
* numPartitions: 128,
|
|
180
|
+
* numSubVectors: 16,
|
|
181
|
+
* }),
|
|
182
|
+
* });
|
|
180
183
|
* @example
|
|
181
184
|
* // Or create a Scalar index
|
|
182
|
-
* await table.createIndex("my_float_col")
|
|
185
|
+
* await table.createIndex("my_float_col");
|
|
183
186
|
*/
|
|
184
187
|
async createIndex(column: string, options?: Partial<IndexOptions>) {
|
|
185
188
|
// Bit of a hack to get around the fact that TS has no package-scope.
|
|
@@ -197,8 +200,7 @@ export class Table {
|
|
|
197
200
|
* vector similarity, sorting, and more.
|
|
198
201
|
*
|
|
199
202
|
* Note: By default, all columns are returned. For best performance, you should
|
|
200
|
-
* only fetch the columns you need.
|
|
201
|
-
* more details.
|
|
203
|
+
* only fetch the columns you need.
|
|
202
204
|
*
|
|
203
205
|
* When appropriate, various indices and statistics based pruning will be used to
|
|
204
206
|
* accelerate the query.
|
|
@@ -206,10 +208,13 @@ export class Table {
|
|
|
206
208
|
* // SQL-style filtering
|
|
207
209
|
* //
|
|
208
210
|
* // This query will return up to 1000 rows whose value in the `id` column
|
|
209
|
-
* // is greater than 5.
|
|
210
|
-
* for await (const batch of table
|
|
211
|
-
*
|
|
212
|
-
*
|
|
211
|
+
* // is greater than 5. LanceDb supports a broad set of filtering functions.
|
|
212
|
+
* for await (const batch of table
|
|
213
|
+
* .query()
|
|
214
|
+
* .where("id > 1")
|
|
215
|
+
* .select(["id"])
|
|
216
|
+
* .limit(20)) {
|
|
217
|
+
* console.log(batch);
|
|
213
218
|
* }
|
|
214
219
|
* @example
|
|
215
220
|
* // Vector Similarity Search
|
|
@@ -218,13 +223,14 @@ export class Table {
|
|
|
218
223
|
* // closest to the query vector [1.0, 2.0, 3.0]. If an index has been created
|
|
219
224
|
* // on the "vector" column then this will perform an ANN search.
|
|
220
225
|
* //
|
|
221
|
-
* // The `
|
|
226
|
+
* // The `refineFactor` and `nprobes` methods are used to control the recall /
|
|
222
227
|
* // latency tradeoff of the search.
|
|
223
|
-
* for await (const batch of table
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
+
* for await (const batch of table
|
|
229
|
+
* .query()
|
|
230
|
+
* .where("id > 1")
|
|
231
|
+
* .select(["id"])
|
|
232
|
+
* .limit(20)) {
|
|
233
|
+
* console.log(batch);
|
|
228
234
|
* }
|
|
229
235
|
* @example
|
|
230
236
|
* // Scan the full dataset
|
|
@@ -286,43 +292,45 @@ export class Table {
|
|
|
286
292
|
await this.inner.dropColumns(columnNames);
|
|
287
293
|
}
|
|
288
294
|
|
|
289
|
-
/**
|
|
290
|
-
* Retrieve the version of the table
|
|
291
|
-
*
|
|
292
|
-
* LanceDb supports versioning. Every operation that modifies the table increases
|
|
293
|
-
* version. As long as a version hasn't been deleted you can `[Self::checkout]` that
|
|
294
|
-
* version to view the data at that point. In addition, you can `[Self::restore]` the
|
|
295
|
-
* version to replace the current table with a previous version.
|
|
296
|
-
*/
|
|
295
|
+
/** Retrieve the version of the table */
|
|
297
296
|
async version(): Promise<number> {
|
|
298
297
|
return await this.inner.version();
|
|
299
298
|
}
|
|
300
299
|
|
|
301
300
|
/**
|
|
302
|
-
* Checks out a specific version of the
|
|
301
|
+
* Checks out a specific version of the table _This is an in-place operation._
|
|
303
302
|
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
303
|
+
* This allows viewing previous versions of the table. If you wish to
|
|
304
|
+
* keep writing to the dataset starting from an old version, then use
|
|
305
|
+
* the `restore` function.
|
|
307
306
|
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
307
|
+
* Calling this method will set the table into time-travel mode. If you
|
|
308
|
+
* wish to return to standard mode, call `checkoutLatest`.
|
|
309
|
+
* @param {number} version The version to checkout
|
|
310
|
+
* @example
|
|
311
|
+
* ```typescript
|
|
312
|
+
* import * as lancedb from "@lancedb/lancedb"
|
|
313
|
+
* const db = await lancedb.connect("./.lancedb");
|
|
314
|
+
* const table = await db.createTable("my_table", [
|
|
315
|
+
* { vector: [1.1, 0.9], type: "vector" },
|
|
316
|
+
* ]);
|
|
314
317
|
*
|
|
315
|
-
*
|
|
318
|
+
* console.log(await table.version()); // 1
|
|
319
|
+
* console.log(table.display());
|
|
320
|
+
* await table.add([{ vector: [0.5, 0.2], type: "vector" }]);
|
|
321
|
+
* await table.checkout(1);
|
|
322
|
+
* console.log(await table.version()); // 2
|
|
323
|
+
* ```
|
|
316
324
|
*/
|
|
317
325
|
async checkout(version: number): Promise<void> {
|
|
318
326
|
await this.inner.checkout(version);
|
|
319
327
|
}
|
|
320
328
|
|
|
321
329
|
/**
|
|
322
|
-
*
|
|
330
|
+
* Checkout the latest version of the table. _This is an in-place operation._
|
|
323
331
|
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
332
|
+
* The table will be set back into standard mode, and will track the latest
|
|
333
|
+
* version of the table.
|
|
326
334
|
*/
|
|
327
335
|
async checkoutLatest(): Promise<void> {
|
|
328
336
|
await this.inner.checkoutLatest();
|
|
@@ -344,9 +352,7 @@ export class Table {
|
|
|
344
352
|
await this.inner.restore();
|
|
345
353
|
}
|
|
346
354
|
|
|
347
|
-
/**
|
|
348
|
-
* List all indices that have been created with Self::create_index
|
|
349
|
-
*/
|
|
355
|
+
/** List all indices that have been created with {@link Table.createIndex} */
|
|
350
356
|
async listIndices(): Promise<IndexConfig[]> {
|
|
351
357
|
return await this.inner.listIndices();
|
|
352
358
|
}
|
|
@@ -104,17 +104,20 @@ export declare class Table {
|
|
|
104
104
|
* // If the column has a vector (fixed size list) data type then
|
|
105
105
|
* // an IvfPq vector index will be created.
|
|
106
106
|
* const table = await conn.openTable("my_table");
|
|
107
|
-
* await table.createIndex(
|
|
107
|
+
* await table.createIndex("vector");
|
|
108
108
|
* @example
|
|
109
109
|
* // For advanced control over vector index creation you can specify
|
|
110
110
|
* // the index type and options.
|
|
111
111
|
* const table = await conn.openTable("my_table");
|
|
112
|
-
* await table.createIndex(
|
|
113
|
-
* .
|
|
114
|
-
*
|
|
112
|
+
* await table.createIndex("vector", {
|
|
113
|
+
* config: lancedb.Index.ivfPq({
|
|
114
|
+
* numPartitions: 128,
|
|
115
|
+
* numSubVectors: 16,
|
|
116
|
+
* }),
|
|
117
|
+
* });
|
|
115
118
|
* @example
|
|
116
119
|
* // Or create a Scalar index
|
|
117
|
-
* await table.createIndex("my_float_col")
|
|
120
|
+
* await table.createIndex("my_float_col");
|
|
118
121
|
*/
|
|
119
122
|
createIndex(column: string, options?: Partial<IndexOptions>): Promise<void>;
|
|
120
123
|
/**
|
|
@@ -126,8 +129,7 @@ export declare class Table {
|
|
|
126
129
|
* vector similarity, sorting, and more.
|
|
127
130
|
*
|
|
128
131
|
* Note: By default, all columns are returned. For best performance, you should
|
|
129
|
-
* only fetch the columns you need.
|
|
130
|
-
* more details.
|
|
132
|
+
* only fetch the columns you need.
|
|
131
133
|
*
|
|
132
134
|
* When appropriate, various indices and statistics based pruning will be used to
|
|
133
135
|
* accelerate the query.
|
|
@@ -135,10 +137,13 @@ export declare class Table {
|
|
|
135
137
|
* // SQL-style filtering
|
|
136
138
|
* //
|
|
137
139
|
* // This query will return up to 1000 rows whose value in the `id` column
|
|
138
|
-
* // is greater than 5.
|
|
139
|
-
* for await (const batch of table
|
|
140
|
-
*
|
|
141
|
-
*
|
|
140
|
+
* // is greater than 5. LanceDb supports a broad set of filtering functions.
|
|
141
|
+
* for await (const batch of table
|
|
142
|
+
* .query()
|
|
143
|
+
* .where("id > 1")
|
|
144
|
+
* .select(["id"])
|
|
145
|
+
* .limit(20)) {
|
|
146
|
+
* console.log(batch);
|
|
142
147
|
* }
|
|
143
148
|
* @example
|
|
144
149
|
* // Vector Similarity Search
|
|
@@ -147,13 +152,14 @@ export declare class Table {
|
|
|
147
152
|
* // closest to the query vector [1.0, 2.0, 3.0]. If an index has been created
|
|
148
153
|
* // on the "vector" column then this will perform an ANN search.
|
|
149
154
|
* //
|
|
150
|
-
* // The `
|
|
155
|
+
* // The `refineFactor` and `nprobes` methods are used to control the recall /
|
|
151
156
|
* // latency tradeoff of the search.
|
|
152
|
-
* for await (const batch of table
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
+
* for await (const batch of table
|
|
158
|
+
* .query()
|
|
159
|
+
* .where("id > 1")
|
|
160
|
+
* .select(["id"])
|
|
161
|
+
* .limit(20)) {
|
|
162
|
+
* console.log(batch);
|
|
157
163
|
* }
|
|
158
164
|
* @example
|
|
159
165
|
* // Scan the full dataset
|
|
@@ -199,37 +205,39 @@ export declare class Table {
|
|
|
199
205
|
* (e.g. "a").
|
|
200
206
|
*/
|
|
201
207
|
dropColumns(columnNames: string[]): Promise<void>;
|
|
202
|
-
/**
|
|
203
|
-
* Retrieve the version of the table
|
|
204
|
-
*
|
|
205
|
-
* LanceDb supports versioning. Every operation that modifies the table increases
|
|
206
|
-
* version. As long as a version hasn't been deleted you can `[Self::checkout]` that
|
|
207
|
-
* version to view the data at that point. In addition, you can `[Self::restore]` the
|
|
208
|
-
* version to replace the current table with a previous version.
|
|
209
|
-
*/
|
|
208
|
+
/** Retrieve the version of the table */
|
|
210
209
|
version(): Promise<number>;
|
|
211
210
|
/**
|
|
212
|
-
* Checks out a specific version of the
|
|
211
|
+
* Checks out a specific version of the table _This is an in-place operation._
|
|
213
212
|
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
213
|
+
* This allows viewing previous versions of the table. If you wish to
|
|
214
|
+
* keep writing to the dataset starting from an old version, then use
|
|
215
|
+
* the `restore` function.
|
|
217
216
|
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
217
|
+
* Calling this method will set the table into time-travel mode. If you
|
|
218
|
+
* wish to return to standard mode, call `checkoutLatest`.
|
|
219
|
+
* @param {number} version The version to checkout
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* import * as lancedb from "@lancedb/lancedb"
|
|
223
|
+
* const db = await lancedb.connect("./.lancedb");
|
|
224
|
+
* const table = await db.createTable("my_table", [
|
|
225
|
+
* { vector: [1.1, 0.9], type: "vector" },
|
|
226
|
+
* ]);
|
|
224
227
|
*
|
|
225
|
-
*
|
|
228
|
+
* console.log(await table.version()); // 1
|
|
229
|
+
* console.log(table.display());
|
|
230
|
+
* await table.add([{ vector: [0.5, 0.2], type: "vector" }]);
|
|
231
|
+
* await table.checkout(1);
|
|
232
|
+
* console.log(await table.version()); // 2
|
|
233
|
+
* ```
|
|
226
234
|
*/
|
|
227
235
|
checkout(version: number): Promise<void>;
|
|
228
236
|
/**
|
|
229
|
-
*
|
|
237
|
+
* Checkout the latest version of the table. _This is an in-place operation._
|
|
230
238
|
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
239
|
+
* The table will be set back into standard mode, and will track the latest
|
|
240
|
+
* version of the table.
|
|
233
241
|
*/
|
|
234
242
|
checkoutLatest(): Promise<void>;
|
|
235
243
|
/**
|
|
@@ -245,8 +253,6 @@ export declare class Table {
|
|
|
245
253
|
* out state and the read_consistency_interval, if any, will apply.
|
|
246
254
|
*/
|
|
247
255
|
restore(): Promise<void>;
|
|
248
|
-
/**
|
|
249
|
-
* List all indices that have been created with Self::create_index
|
|
250
|
-
*/
|
|
256
|
+
/** List all indices that have been created with {@link Table.createIndex} */
|
|
251
257
|
listIndices(): Promise<IndexConfig[]>;
|
|
252
258
|
}
|
|
@@ -123,17 +123,20 @@ class Table {
|
|
|
123
123
|
* // If the column has a vector (fixed size list) data type then
|
|
124
124
|
* // an IvfPq vector index will be created.
|
|
125
125
|
* const table = await conn.openTable("my_table");
|
|
126
|
-
* await table.createIndex(
|
|
126
|
+
* await table.createIndex("vector");
|
|
127
127
|
* @example
|
|
128
128
|
* // For advanced control over vector index creation you can specify
|
|
129
129
|
* // the index type and options.
|
|
130
130
|
* const table = await conn.openTable("my_table");
|
|
131
|
-
* await table.createIndex(
|
|
132
|
-
* .
|
|
133
|
-
*
|
|
131
|
+
* await table.createIndex("vector", {
|
|
132
|
+
* config: lancedb.Index.ivfPq({
|
|
133
|
+
* numPartitions: 128,
|
|
134
|
+
* numSubVectors: 16,
|
|
135
|
+
* }),
|
|
136
|
+
* });
|
|
134
137
|
* @example
|
|
135
138
|
* // Or create a Scalar index
|
|
136
|
-
* await table.createIndex("my_float_col")
|
|
139
|
+
* await table.createIndex("my_float_col");
|
|
137
140
|
*/
|
|
138
141
|
async createIndex(column, options) {
|
|
139
142
|
// Bit of a hack to get around the fact that TS has no package-scope.
|
|
@@ -150,8 +153,7 @@ class Table {
|
|
|
150
153
|
* vector similarity, sorting, and more.
|
|
151
154
|
*
|
|
152
155
|
* Note: By default, all columns are returned. For best performance, you should
|
|
153
|
-
* only fetch the columns you need.
|
|
154
|
-
* more details.
|
|
156
|
+
* only fetch the columns you need.
|
|
155
157
|
*
|
|
156
158
|
* When appropriate, various indices and statistics based pruning will be used to
|
|
157
159
|
* accelerate the query.
|
|
@@ -159,10 +161,13 @@ class Table {
|
|
|
159
161
|
* // SQL-style filtering
|
|
160
162
|
* //
|
|
161
163
|
* // This query will return up to 1000 rows whose value in the `id` column
|
|
162
|
-
* // is greater than 5.
|
|
163
|
-
* for await (const batch of table
|
|
164
|
-
*
|
|
165
|
-
*
|
|
164
|
+
* // is greater than 5. LanceDb supports a broad set of filtering functions.
|
|
165
|
+
* for await (const batch of table
|
|
166
|
+
* .query()
|
|
167
|
+
* .where("id > 1")
|
|
168
|
+
* .select(["id"])
|
|
169
|
+
* .limit(20)) {
|
|
170
|
+
* console.log(batch);
|
|
166
171
|
* }
|
|
167
172
|
* @example
|
|
168
173
|
* // Vector Similarity Search
|
|
@@ -171,13 +176,14 @@ class Table {
|
|
|
171
176
|
* // closest to the query vector [1.0, 2.0, 3.0]. If an index has been created
|
|
172
177
|
* // on the "vector" column then this will perform an ANN search.
|
|
173
178
|
* //
|
|
174
|
-
* // The `
|
|
179
|
+
* // The `refineFactor` and `nprobes` methods are used to control the recall /
|
|
175
180
|
* // latency tradeoff of the search.
|
|
176
|
-
* for await (const batch of table
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
+
* for await (const batch of table
|
|
182
|
+
* .query()
|
|
183
|
+
* .where("id > 1")
|
|
184
|
+
* .select(["id"])
|
|
185
|
+
* .limit(20)) {
|
|
186
|
+
* console.log(batch);
|
|
181
187
|
* }
|
|
182
188
|
* @example
|
|
183
189
|
* // Scan the full dataset
|
|
@@ -234,41 +240,43 @@ class Table {
|
|
|
234
240
|
async dropColumns(columnNames) {
|
|
235
241
|
await this.inner.dropColumns(columnNames);
|
|
236
242
|
}
|
|
237
|
-
/**
|
|
238
|
-
* Retrieve the version of the table
|
|
239
|
-
*
|
|
240
|
-
* LanceDb supports versioning. Every operation that modifies the table increases
|
|
241
|
-
* version. As long as a version hasn't been deleted you can `[Self::checkout]` that
|
|
242
|
-
* version to view the data at that point. In addition, you can `[Self::restore]` the
|
|
243
|
-
* version to replace the current table with a previous version.
|
|
244
|
-
*/
|
|
243
|
+
/** Retrieve the version of the table */
|
|
245
244
|
async version() {
|
|
246
245
|
return await this.inner.version();
|
|
247
246
|
}
|
|
248
247
|
/**
|
|
249
|
-
* Checks out a specific version of the
|
|
248
|
+
* Checks out a specific version of the table _This is an in-place operation._
|
|
250
249
|
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
250
|
+
* This allows viewing previous versions of the table. If you wish to
|
|
251
|
+
* keep writing to the dataset starting from an old version, then use
|
|
252
|
+
* the `restore` function.
|
|
254
253
|
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
254
|
+
* Calling this method will set the table into time-travel mode. If you
|
|
255
|
+
* wish to return to standard mode, call `checkoutLatest`.
|
|
256
|
+
* @param {number} version The version to checkout
|
|
257
|
+
* @example
|
|
258
|
+
* ```typescript
|
|
259
|
+
* import * as lancedb from "@lancedb/lancedb"
|
|
260
|
+
* const db = await lancedb.connect("./.lancedb");
|
|
261
|
+
* const table = await db.createTable("my_table", [
|
|
262
|
+
* { vector: [1.1, 0.9], type: "vector" },
|
|
263
|
+
* ]);
|
|
261
264
|
*
|
|
262
|
-
*
|
|
265
|
+
* console.log(await table.version()); // 1
|
|
266
|
+
* console.log(table.display());
|
|
267
|
+
* await table.add([{ vector: [0.5, 0.2], type: "vector" }]);
|
|
268
|
+
* await table.checkout(1);
|
|
269
|
+
* console.log(await table.version()); // 2
|
|
270
|
+
* ```
|
|
263
271
|
*/
|
|
264
272
|
async checkout(version) {
|
|
265
273
|
await this.inner.checkout(version);
|
|
266
274
|
}
|
|
267
275
|
/**
|
|
268
|
-
*
|
|
276
|
+
* Checkout the latest version of the table. _This is an in-place operation._
|
|
269
277
|
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
278
|
+
* The table will be set back into standard mode, and will track the latest
|
|
279
|
+
* version of the table.
|
|
272
280
|
*/
|
|
273
281
|
async checkoutLatest() {
|
|
274
282
|
await this.inner.checkoutLatest();
|
|
@@ -288,9 +296,7 @@ class Table {
|
|
|
288
296
|
async restore() {
|
|
289
297
|
await this.inner.restore();
|
|
290
298
|
}
|
|
291
|
-
/**
|
|
292
|
-
* List all indices that have been created with Self::create_index
|
|
293
|
-
*/
|
|
299
|
+
/** List all indices that have been created with {@link Table.createIndex} */
|
|
294
300
|
async listIndices() {
|
|
295
301
|
return await this.inner.listIndices();
|
|
296
302
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lancedb/lancedb",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.19",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"napi": {
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"build-release": "npm run build:release && tsc -b && shx cp lancedb/native.d.ts dist/native.d.ts",
|
|
63
63
|
"chkformat": "prettier . --check",
|
|
64
64
|
"docs": "typedoc --plugin typedoc-plugin-markdown --out ../docs/src/js lancedb/index.ts",
|
|
65
|
-
"lint": "eslint lancedb
|
|
65
|
+
"lint": "eslint lancedb __test__",
|
|
66
|
+
"lint-fix": "eslint lancedb __test__ --fix",
|
|
66
67
|
"prepublishOnly": "napi prepublish -t npm",
|
|
67
68
|
"test": "npm run build && jest --verbose",
|
|
68
69
|
"integration": "S3_TEST=1 npm run test",
|
|
@@ -74,10 +75,10 @@
|
|
|
74
75
|
"apache-arrow": "^15.0.0"
|
|
75
76
|
},
|
|
76
77
|
"optionalDependencies": {
|
|
77
|
-
"@lancedb/lancedb-darwin-arm64": "0.4.
|
|
78
|
-
"@lancedb/lancedb-linux-arm64-gnu": "0.4.
|
|
79
|
-
"@lancedb/lancedb-darwin-x64": "0.4.
|
|
80
|
-
"@lancedb/lancedb-linux-x64-gnu": "0.4.
|
|
81
|
-
"@lancedb/lancedb-win32-x64-msvc": "0.4.
|
|
78
|
+
"@lancedb/lancedb-darwin-arm64": "0.4.19",
|
|
79
|
+
"@lancedb/lancedb-linux-arm64-gnu": "0.4.19",
|
|
80
|
+
"@lancedb/lancedb-darwin-x64": "0.4.19",
|
|
81
|
+
"@lancedb/lancedb-linux-x64-gnu": "0.4.19",
|
|
82
|
+
"@lancedb/lancedb-win32-x64-msvc": "0.4.19"
|
|
82
83
|
}
|
|
83
84
|
}
|