Import, export, and migrate data
Move data in and out of a table. Use TaruviBase Console for one-off files, or write a migration script that validates every record and sends it in batches through an SDK or the REST API.
Choose a data-movement workflow
For a one-off import or export, use TaruviBase Console: open your app, select Datatables, open the table's menu, and select Import data or Export data. Imports run as a job; check progress and download any error report under History. Use the SDK or REST workflow below for large, repeatable, or automated migrations.
| Task | Recommended workflow |
|---|---|
| Import records | Normalize the source, then use bounded create or update batches |
| Export records | Read stable, bounded pages from an unchanged source set and write each completed page to the destination |
| Resume work | Persist an application-owned checkpoint after each verified batch |
| Report rejected rows | Keep a redacted application report with the source key and validation result |
| Retry an unknown outcome | Read the stable destination IDs before resending a write |
Using the SDK or REST API means every batch goes through the same access checks as the rest of your application. Save your progress after each batch and keep a report of rejected rows so you can resume and check the transfer.
1. Prepare the destination
- Save the destination table's exact stored schema JSON in the migration manifest. If a checksum is useful, compute one over that saved file and record both the checksum and algorithm.
- Confirm the site, app, and table selected for the migration.
- Create a disposable app with the same schema for a rehearsal.
- Back up the source and record its row count.
For retryable imports, supply an application-owned UUID and keep a stable mapping between the source identifier and TaruviBase identifier. This prevents an ambiguous retry from creating a second logical record.
2. Normalize and validate records
Convert each source row to the destination field names and value types before sending it to TaruviBase. Reject or quarantine a row when it:
- omits a required field;
- violates a length, range, enum, unique, or foreign-key constraint;
- contains an unknown field; or
- cannot be mapped to one explicit destination identifier.
Test one synthetic record first, read it back, and compare the stored values.
3. Send a bounded batch
Use bulk create or bulk update for records whose outcome can be tracked as one batch. Keep every batch at 1,000 records or fewer and keep the ordered list of record IDs.
- JavaScript SDK
- Python SDK
- REST API
await database.from('tasks').create(batch).execute();
client.database.create("tasks", batch)
/api/apps/$TARUVI_APP_SLUG/datatables/tasks/data/FIRST_TASK_ID="$(uuidgen | tr '[:upper:]' '[:lower:]')"
SECOND_TASK_ID="$(uuidgen | tr '[:upper:]' '[:lower:]')"
curl -X POST "$TARUVI_SITE_URL/api/apps/$TARUVI_APP_SLUG/datatables/tasks/data/" \
-H "Authorization: Api-Key $TARUVI_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<JSON
[
{
"id": "$FIRST_TASK_ID",
"title": "Prepare release notes",
"done": false
},
{
"id": "$SECOND_TASK_ID",
"title": "Publish release notes",
"done": false
}
]
JSON
201Returns the created records in data.
Here, batch is the validated list for one checkpoint. Compare the returned
record count with the batch size before advancing the checkpoint.
For an export, pause source writes or capture an immutable record-ID manifest, then page through the unchanged source set with stable ordering. Write each completed page to the destination file or system. Do not rely on a single unbounded list response.
- JavaScript SDK
- Python SDK
- REST API
await database
.from('tasks')
.sort('id', 'asc')
.page(page)
.pageSize(100)
.execute();
(
client.database
.from_("tasks")
.sort("id", "asc")
.page(page)
.page_size(100)
.execute()
)
/api/apps/$TARUVI_APP_SLUG/datatables/tasks/data/PAGE="${PAGE:-1}"
curl -G "$TARUVI_SITE_URL/api/apps/$TARUVI_APP_SLUG/datatables/tasks/data/" \
-H "Authorization: Api-Key $TARUVI_API_KEY" \
--data-urlencode "ordering=id" \
--data-urlencode "page=$PAGE" \
--data-urlencode "page_size=100"
200Returns one stable export page in data and the complete record count in total.
Set page to the next checkpointed page and keep the stable id ordering.
Page checkpoints are resumable only while the source result set remains
unchanged; stable ordering alone does not create a cross-request snapshot.
4. Checkpoint progress
After every successful batch, persist:
- the source range, ID manifest, or page within a quiesced source;
- the destination record IDs;
- the saved schema file and its application-owned checksum, when used;
- the attempted, accepted, and rejected counts; and
- the completion timestamp.
Resume from the last verified checkpoint. When a request outcome is unknown, read the explicit IDs before retrying the write.
5. Check and finish
- Compare the source, accepted, rejected, and destination counts.
- Read a sample from every batch, including boundary values.
- Verify foreign-key references after all dependent records are present.
- Retain a redacted error report for rejected rows.
- Affected resource and cascade: Cleanup targets only the reviewed rehearsal or destination record IDs in the named site, app, and table. Review foreign-key behavior before cleanup.
- Reversibility: Record deletion is permanent.
- Authorization: The cleanup caller needs the table policy's
deleteaction for every target record. - Backup or export: Retain the verified source backup, migration manifest, and exported cleanup records.
- Confirmation: Compare the exact cleanup ID list and count with the reconciled rehearsal or destination records.
- Success response and postcondition: Use the canonical single-record or bulk-delete response contract, compare the deleted count when present, and verify every target ID is absent.
- Recovery: This guide documents no undelete operation. Recreate cleanup records only from the retained export and re-run reconciliation.
- Remove rehearsal data only after reconciliation succeeds.
Cross-batch atomicity is not assumed. Design the migration so every completed batch is independently verifiable and every rejected row can be corrected and replayed without repeating successful writes.
Continue with query pagination, reliability, or the interface map.