Recreates a base from output of air_dump(). When attachments is
"file", uploads attachment files from the dump directory after record
creation. For CSV dumps, automatically detects and parses the flattened format.
Usage
air_restore(
dump,
base_name = NULL,
workspace_id = NULL,
attachments = c("file", "meta"),
attachment_dir = NULL,
restore_linked_fields = TRUE,
.token = NULL
)Arguments
- dump
Either a list (from
air_dump(format = "list")) or a path to a dump directory (fromair_dump(format = "json")orair_dump(format = "csv")).- base_name
Name for the new base. If
NULL, uses a generated name.- workspace_id
Workspace ID to create the base in.
- attachments
How to handle attachment fields:
"meta"(default) keeps only metadata (filename, url, size, type);"file"downloads toattachment_dir;"blob"downloads as in-memory raw vectors.- attachment_dir
Directory for downloading attachments (required when
attachments = "file"). Files are saved as{attachment_dir}/{record_id}/{filename}.- restore_linked_fields
If
TRUE(the default), after all records are created, linked-record fields (multipleRecordLinks) and their dependent computed fields (rollup,lookup,count) are recreated with remapped table/field IDs, and the link cell values (record-to-record connections) are repopulated by remapping old record IDs to the newly created record IDs. Set toFALSEto skip this step (faster, but links will be empty).- .token
Personal access token (resolved via
air_token()ifNULL).
Linked-record fields
Linked-record fields (multipleRecordLinks) and the computed fields that
depend on them (rollup, lookup, count) are skipped during the initial
field-creation pass because their options reference base-specific IDs.
When restore_linked_fields = TRUE (the default), after all records are
inserted a two-step pass runs:
Field definitions:
multipleRecordLinksfields are recreated withlinkedTableIdremapped to the new base's table IDs.Cell values: the link columns in the dump contain old record IDs. These are remapped to the new record IDs (matched by insertion order) and written back via
air_upsert().