import Datagrid from "datagrid-ai";
const datagrid = new Datagrid();
// Fetch the last sync cursor from your storage
const cursor = await fetchLastSyncCursor(tableId);
const response = await datagrid.knowledge.tables.records.list(tableId, {
next: cursor,
limit: 500,
});
for await (const page of response.iterPages()) {
// Push record batch to your destination system
await pushRecords(page.data);
// Store the cursor, indicating that you have replicated the data up to this point
await storeCursor(tableId, page.cursor);
}