docs: fix the two snippet imports Mint cannot resolve

Two pages imported PySchemaAddSetup under the alias SchemaAddSetup, and
Mint resolved only the first, failing `mint validate` on
management/table.mdx. Both pages now import it unaliased.

TsAddProgress was added to the generated tables snippets by hand in
lancedb/docs#243 and dropped by the next regeneration, leaving
ingestion/insert.mdx with a missing import. Its example is restored
unchanged as a test in docs/web-tests/ts/tables.test.ts, which checks
that the callback reports the finished write.
This commit is contained in:
Brendan Clement
2026-10-05 13:27:53 -07:00
parent c2c16b60b9
commit 41ec678699
4 changed files with 41 additions and 5 deletions
+35 -1
View File
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright The LanceDB Authors
import { expect, test } from "@jest/globals";
import { expect, jest, test } from "@jest/globals";
import * as arrow from "apache-arrow";
import * as lancedb from "@lancedb/lancedb";
import { withTempDirectory } from "./util.ts";
@@ -194,6 +194,40 @@ test("table creation snippets (async)", async () => {
});
});
test("add progress snippet (async)", async () => {
await withTempDirectory(async (databaseDir) => {
const db = await lancedb.connect(databaseDir);
const table = await db.createTable("progress_table", [
{ vector: [1.1, 1.2], item: "foo" },
]);
const moreData = [
{ vector: [2.1, 2.2], item: "bar" },
{ vector: [3.1, 3.2], item: "baz" },
];
const log = jest.spyOn(console, "log").mockImplementation(() => {});
try {
// --8<-- [start:add_progress]
// Track ingestion progress as batches are written.
await table.add(moreData, {
progress: (p) => {
const total = p.totalRows ?? "?";
console.log(
`wrote ${p.outputRows}/${total} rows ` +
`(${p.outputBytes} bytes, ${p.elapsedSeconds.toFixed(1)}s, ` +
`${p.activeTasks}/${p.totalTasks} tasks active)` +
(p.done ? " \u2014 done" : ""),
);
},
});
// --8<-- [end:add_progress]
expect(log.mock.calls.at(-1)?.[0]).toMatch(/^wrote 2\/2 rows .* — done$/);
} finally {
log.mockRestore();
}
expect(await table.countRows()).toBe(3);
});
});
test("schema evolution snippets (async)", async () => {
await withTempDirectory(async (databaseDir) => {
const db = await lancedb.connect(databaseDir);