← Changelog
NewApps

Import and export a model's records as CSV

The record grid now has Export CSV and Import CSV beside its pages. Export downloads the records the grid shows, with its filter and sort; Import reads a file, shows what it would do (columns matched to fields, new and updated records, rows with problems and why), and imports it in the background once you confirm.

Rows are matched to records by id, or by a field with a unique validation, and a match is updated. Matched by id, new records keep the file's ids, so an export from development imports into production with its belongsTo links intact. Rows are written directly as one event in Logs, or with actions on, queued as jobs for the model's create and update actions. Backups can put the model back to before an import.

The same is on the API (GET …/models/:model/export.csv and POST …/models/:model/import, which plans or applies) and in the CLI: ib-apps records export and ib-apps records import, in @inferencebureau/apps 0.8.0. A file is at most 4 MB and 50,000 rows.

More in Import and export CSV.