mirror of
https://github.com/lancedb/lancedb.git
synced 2026-09-04 12:38:38 +00:00
049b0c8f09
### Summary
- Add an optional `progress` callback to `Table.add(data, { progress
})`. Callback fires once per batch written and once more with `done:
true` when the write completes.
- Errors thrown from the user's callback are logged with `console.warn`
and swallowed
### Testing
- npm test
- ran smoke test script to verify functionality
58 lines
1.1 KiB
Markdown
58 lines
1.1 KiB
Markdown
[**@lancedb/lancedb**](../README.md) • **Docs**
|
|
|
|
***
|
|
|
|
[@lancedb/lancedb](../globals.md) / AddDataOptions
|
|
|
|
# Interface: AddDataOptions
|
|
|
|
Options for adding data to a table.
|
|
|
|
## Properties
|
|
|
|
### mode
|
|
|
|
```ts
|
|
mode: "append" | "overwrite";
|
|
```
|
|
|
|
If "append" (the default) then the new data will be added to the table
|
|
|
|
If "overwrite" then the new data will replace the existing data in the table.
|
|
|
|
***
|
|
|
|
### progress()
|
|
|
|
```ts
|
|
progress: (progress) => void;
|
|
```
|
|
|
|
Optional callback invoked periodically with write progress.
|
|
|
|
The callback is fired once per batch written and once more with
|
|
`done: true` when the write completes. Calls are dispatched
|
|
asynchronously to the JS event loop and never block the write — a slow
|
|
callback will queue events rather than back-pressure the writer.
|
|
|
|
Errors thrown from the callback are logged with `console.warn` and
|
|
swallowed — they do not abort the write.
|
|
|
|
#### Parameters
|
|
|
|
* **progress**: [`WriteProgress`](WriteProgress.md)
|
|
|
|
#### Returns
|
|
|
|
`void`
|
|
|
|
#### Example
|
|
|
|
```ts
|
|
await table.add(data, {
|
|
progress: (p) => {
|
|
console.log(`${p.outputRows}/${p.totalRows ?? "?"} rows`);
|
|
},
|
|
});
|
|
```
|