@lancedb/lancedb 0.19.0 → 0.19.1-beta.1

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Connection } from "./connection";
2
2
  import { ConnectionOptions } from "./native.js";
3
- export { AddColumnsSql, ConnectionOptions, IndexStatistics, IndexConfig, ClientConfig, TimeoutConfig, RetryConfig, OptimizeStats, CompactionStats, RemovalStats, } from "./native.js";
3
+ export { AddColumnsSql, ConnectionOptions, IndexStatistics, IndexConfig, ClientConfig, TimeoutConfig, RetryConfig, OptimizeStats, CompactionStats, RemovalStats, TableStatistics, FragmentStatistics, FragmentSummaryStats, Tags, TagContents, } from "./native.js";
4
4
  export { makeArrowTable, MakeArrowTableOptions, Data, VectorColumnOptions, } from "./arrow";
5
5
  export { Connection, CreateTableOptions, TableNamesOptions, OpenTableOptions, } from "./connection";
6
6
  export { ExecutableQuery, Query, QueryBase, VectorQuery, QueryExecutionOptions, FullTextSearchOptions, RecordBatchIterator, FullTextQuery, MatchQuery, PhraseQuery, BoostQuery, MultiMatchQuery, FullTextQueryType, } from "./query";
package/dist/index.js CHANGED
@@ -2,10 +2,13 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  // SPDX-FileCopyrightText: Copyright The LanceDB Authors
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.packBits = exports.rerankers = exports.embedding = exports.MergeInsertBuilder = exports.Table = exports.Index = exports.FullTextQueryType = exports.MultiMatchQuery = exports.BoostQuery = exports.PhraseQuery = exports.MatchQuery = exports.RecordBatchIterator = exports.VectorQuery = exports.QueryBase = exports.Query = exports.Connection = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = void 0;
5
+ exports.packBits = exports.rerankers = exports.embedding = exports.MergeInsertBuilder = exports.Table = exports.Index = exports.FullTextQueryType = exports.MultiMatchQuery = exports.BoostQuery = exports.PhraseQuery = exports.MatchQuery = exports.RecordBatchIterator = exports.VectorQuery = exports.QueryBase = exports.Query = exports.Connection = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = exports.TagContents = exports.Tags = void 0;
6
6
  exports.connect = connect;
7
7
  const connection_1 = require("./connection");
8
8
  const native_js_1 = require("./native.js");
9
+ var native_js_2 = require("./native.js");
10
+ Object.defineProperty(exports, "Tags", { enumerable: true, get: function () { return native_js_2.Tags; } });
11
+ Object.defineProperty(exports, "TagContents", { enumerable: true, get: function () { return native_js_2.TagContents; } });
9
12
  var arrow_1 = require("./arrow");
10
13
  Object.defineProperty(exports, "makeArrowTable", { enumerable: true, get: function () { return arrow_1.makeArrowTable; } });
11
14
  Object.defineProperty(exports, "MakeArrowTableOptions", { enumerable: true, get: function () { return arrow_1.MakeArrowTableOptions; } });
package/dist/native.d.ts CHANGED
@@ -191,6 +191,40 @@ export interface IndexStatistics {
191
191
  */
192
192
  loss?: number
193
193
  }
194
+ export interface TableStatistics {
195
+ /** The total number of bytes in the table */
196
+ totalBytes: number
197
+ /** The number of rows in the table */
198
+ numRows: number
199
+ /** The number of indices in the table */
200
+ numIndices: number
201
+ /** Statistics on table fragments */
202
+ fragmentStats: FragmentStatistics
203
+ }
204
+ export interface FragmentStatistics {
205
+ /** The number of fragments in the table */
206
+ numFragments: number
207
+ /** The number of uncompacted fragments in the table */
208
+ numSmallFragments: number
209
+ /** Statistics on the number of rows in the table fragments */
210
+ lengths: FragmentSummaryStats
211
+ }
212
+ export interface FragmentSummaryStats {
213
+ /** The number of rows in the fragment with the fewest rows */
214
+ min: number
215
+ /** The number of rows in the fragment with the most rows */
216
+ max: number
217
+ /** The mean number of rows in the fragments */
218
+ mean: number
219
+ /** The 25th percentile of number of rows in the fragments */
220
+ p25: number
221
+ /** The 50th percentile of number of rows in the fragments */
222
+ p50: number
223
+ /** The 75th percentile of number of rows in the fragments */
224
+ p75: number
225
+ /** The 99th percentile of number of rows in the fragments */
226
+ p99: number
227
+ }
194
228
  export interface Version {
195
229
  version: number
196
230
  timestamp: number
@@ -353,6 +387,7 @@ export class Table {
353
387
  dropIndex(indexName: string): Promise<void>
354
388
  prewarmIndex(indexName: string): Promise<void>
355
389
  waitForIndex(indexNames: Array<string>, timeoutS: number): Promise<void>
390
+ stats(): Promise<TableStatistics>
356
391
  update(onlyIf: string | undefined | null, columns: Array<[string, string]>): Promise<bigint>
357
392
  query(): Query
358
393
  vectorSearch(vector: Float32Array): VectorQuery
@@ -361,9 +396,11 @@ export class Table {
361
396
  dropColumns(columns: Array<string>): Promise<void>
362
397
  version(): Promise<number>
363
398
  checkout(version: number): Promise<void>
399
+ checkoutTag(tag: string): Promise<void>
364
400
  checkoutLatest(): Promise<void>
365
401
  listVersions(): Promise<Array<Version>>
366
402
  restore(): Promise<void>
403
+ tags(): Promise<Tags>
367
404
  optimize(olderThanMs?: number | undefined | null, deleteUnverified?: boolean | undefined | null): Promise<OptimizeStats>
368
405
  listIndices(): Promise<Array<IndexConfig>>
369
406
  indexStats(indexName: string): Promise<IndexStatistics | null>
@@ -371,3 +408,14 @@ export class Table {
371
408
  usesV2ManifestPaths(): Promise<boolean>
372
409
  migrateManifestPathsV2(): Promise<void>
373
410
  }
411
+ export class TagContents {
412
+ version: number
413
+ manifestSize: number
414
+ }
415
+ export class Tags {
416
+ list(): Promise<Record<string, TagContents>>
417
+ getVersion(tag: string): Promise<number>
418
+ create(tag: string, version: number): Promise<void>
419
+ delete(tag: string): Promise<void>
420
+ update(tag: string, version: number): Promise<void>
421
+ }
package/dist/native.js CHANGED
@@ -319,7 +319,7 @@ if (!nativeBinding) {
319
319
  }
320
320
  throw new Error(`Failed to load native binding`);
321
321
  }
322
- const { Connection, Index, RecordBatchIterator, NativeMergeInsertBuilder, Query, VectorQuery, JsFullTextQuery, Reranker, RrfReranker, Table } = nativeBinding;
322
+ const { Connection, Index, RecordBatchIterator, NativeMergeInsertBuilder, Query, VectorQuery, JsFullTextQuery, Reranker, RrfReranker, Table, TagContents, Tags } = nativeBinding;
323
323
  module.exports.Connection = Connection;
324
324
  module.exports.Index = Index;
325
325
  module.exports.RecordBatchIterator = RecordBatchIterator;
@@ -330,3 +330,5 @@ module.exports.JsFullTextQuery = JsFullTextQuery;
330
330
  module.exports.Reranker = Reranker;
331
331
  module.exports.RrfReranker = RrfReranker;
332
332
  module.exports.Table = Table;
333
+ module.exports.TagContents = TagContents;
334
+ module.exports.Tags = Tags;
package/dist/table.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Table as ArrowTable, Data, DataType, IntoVector, Schema } from "./arrow";
2
2
  import { IndexOptions } from "./indices";
3
3
  import { MergeInsertBuilder } from "./merge";
4
- import { AddColumnsSql, IndexConfig, IndexStatistics, OptimizeStats, Table as _NativeTable } from "./native";
4
+ import { AddColumnsSql, IndexConfig, IndexStatistics, OptimizeStats, TableStatistics, Tags, Table as _NativeTable } from "./native";
5
5
  import { FullTextQuery, Query, VectorQuery } from "./query";
6
6
  import { IntoSql } from "./util";
7
7
  export { IndexConfig } from "./native";
@@ -314,7 +314,7 @@ export declare abstract class Table {
314
314
  *
315
315
  * Calling this method will set the table into time-travel mode. If you
316
316
  * wish to return to standard mode, call `checkoutLatest`.
317
- * @param {number} version The version to checkout
317
+ * @param {number | string} version The version to checkout, could be version number or tag
318
318
  * @example
319
319
  * ```typescript
320
320
  * import * as lancedb from "@lancedb/lancedb"
@@ -330,7 +330,7 @@ export declare abstract class Table {
330
330
  * console.log(await table.version()); // 2
331
331
  * ```
332
332
  */
333
- abstract checkout(version: number): Promise<void>;
333
+ abstract checkout(version: number | string): Promise<void>;
334
334
  /**
335
335
  * Checkout the latest version of the table. _This is an in-place operation._
336
336
  *
@@ -342,6 +342,22 @@ export declare abstract class Table {
342
342
  * List all the versions of the table
343
343
  */
344
344
  abstract listVersions(): Promise<Version[]>;
345
+ /**
346
+ * Get a tags manager for this table.
347
+ *
348
+ * Tags allow you to label specific versions of a table with a human-readable name.
349
+ * The returned tags manager can be used to list, create, update, or delete tags.
350
+ *
351
+ * @returns {Tags} A tags manager for this table
352
+ * @example
353
+ * ```typescript
354
+ * const tagsManager = await table.tags();
355
+ * await tagsManager.create("v1", 1);
356
+ * const tags = await tagsManager.list();
357
+ * console.log(tags); // { "v1": { version: 1, manifestSize: ... } }
358
+ * ```
359
+ */
360
+ abstract tags(): Promise<Tags>;
345
361
  /**
346
362
  * Restore the table to the currently checked out version
347
363
  *
@@ -399,6 +415,12 @@ export declare abstract class Table {
399
415
  * Use {@link Table.listIndices} to find the names of the indices.
400
416
  */
401
417
  abstract indexStats(name: string): Promise<IndexStatistics | undefined>;
418
+ /** Returns table and fragment statistics
419
+ *
420
+ * @returns {TableStatistics} The table and fragment statistics
421
+ *
422
+ */
423
+ abstract stats(): Promise<TableStatistics>;
402
424
  }
403
425
  export declare class LocalTable extends Table {
404
426
  private readonly inner;
@@ -429,14 +451,16 @@ export declare class LocalTable extends Table {
429
451
  alterColumns(columnAlterations: ColumnAlteration[]): Promise<void>;
430
452
  dropColumns(columnNames: string[]): Promise<void>;
431
453
  version(): Promise<number>;
432
- checkout(version: number): Promise<void>;
454
+ checkout(version: number | string): Promise<void>;
433
455
  checkoutLatest(): Promise<void>;
434
456
  listVersions(): Promise<Version[]>;
435
457
  restore(): Promise<void>;
458
+ tags(): Promise<Tags>;
436
459
  optimize(options?: Partial<OptimizeOptions>): Promise<OptimizeStats>;
437
460
  listIndices(): Promise<IndexConfig[]>;
438
461
  toArrow(): Promise<ArrowTable>;
439
462
  indexStats(name: string): Promise<IndexStatistics | undefined>;
463
+ stats(): Promise<TableStatistics>;
440
464
  mergeInsert(on: string | string[]): MergeInsertBuilder;
441
465
  /**
442
466
  * Check if the table uses the new manifest path scheme.
package/dist/table.js CHANGED
@@ -208,7 +208,10 @@ class LocalTable extends Table {
208
208
  return await this.inner.version();
209
209
  }
210
210
  async checkout(version) {
211
- await this.inner.checkout(version);
211
+ if (typeof version === "string") {
212
+ return this.inner.checkoutTag(version);
213
+ }
214
+ return this.inner.checkout(version);
212
215
  }
213
216
  async checkoutLatest() {
214
217
  await this.inner.checkoutLatest();
@@ -223,6 +226,9 @@ class LocalTable extends Table {
223
226
  async restore() {
224
227
  await this.inner.restore();
225
228
  }
229
+ async tags() {
230
+ return await this.inner.tags();
231
+ }
226
232
  async optimize(options) {
227
233
  let cleanupOlderThanMs;
228
234
  if (options?.cleanupOlderThan !== undefined &&
@@ -245,6 +251,9 @@ class LocalTable extends Table {
245
251
  }
246
252
  return stats;
247
253
  }
254
+ async stats() {
255
+ return await this.inner.stats();
256
+ }
248
257
  mergeInsert(on) {
249
258
  on = Array.isArray(on) ? on : [on];
250
259
  return new merge_1.MergeInsertBuilder(this.inner.mergeInsert(on), this.schema());
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "ann"
12
12
  ],
13
13
  "private": false,
14
- "version": "0.19.0",
14
+ "version": "0.19.1-beta.1",
15
15
  "main": "dist/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -100,14 +100,14 @@
100
100
  "reflect-metadata": "^0.2.2"
101
101
  },
102
102
  "optionalDependencies": {
103
- "@lancedb/lancedb-darwin-x64": "0.19.0",
104
- "@lancedb/lancedb-darwin-arm64": "0.19.0",
105
- "@lancedb/lancedb-linux-x64-gnu": "0.19.0",
106
- "@lancedb/lancedb-linux-arm64-gnu": "0.19.0",
107
- "@lancedb/lancedb-linux-x64-musl": "0.19.0",
108
- "@lancedb/lancedb-linux-arm64-musl": "0.19.0",
109
- "@lancedb/lancedb-win32-x64-msvc": "0.19.0",
110
- "@lancedb/lancedb-win32-arm64-msvc": "0.19.0"
103
+ "@lancedb/lancedb-darwin-x64": "0.19.1-beta.1",
104
+ "@lancedb/lancedb-darwin-arm64": "0.19.1-beta.1",
105
+ "@lancedb/lancedb-linux-x64-gnu": "0.19.1-beta.1",
106
+ "@lancedb/lancedb-linux-arm64-gnu": "0.19.1-beta.1",
107
+ "@lancedb/lancedb-linux-x64-musl": "0.19.1-beta.1",
108
+ "@lancedb/lancedb-linux-arm64-musl": "0.19.1-beta.1",
109
+ "@lancedb/lancedb-win32-x64-msvc": "0.19.1-beta.1",
110
+ "@lancedb/lancedb-win32-arm64-msvc": "0.19.1-beta.1"
111
111
  },
112
112
  "peerDependencies": {
113
113
  "apache-arrow": ">=15.0.0 <=18.1.0"