How It Works
Thetables.records.list endpoint returns a cursor with each response. By storing this cursor and passing it as the next parameter in subsequent requests, you can fetch only the records that have changed since your last replication.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Incrementally replicate table records to your destination system
tables.records.list endpoint returns a cursor with each response. By storing this cursor and passing it as the next parameter in subsequent requests, you can fetch only the records that have changed since your last replication.
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);
}
from datagrid_ai import Datagrid
datagrid = Datagrid()
# Fetch the last sync cursor from your storage
cursor = await fetch_last_sync_cursor(table_id)
response = datagrid.knowledge.tables.records.list(
table_id,
next=cursor,
limit=500,
)
for page in response.iter_pages():
# Push record batch to your destination system
await push_records(page.data)
# Store the cursor, indicating that you have replicated the data up to this point
await store_cursor(table_id, page.cursor)