Load in dependency order
Use the import endpoints correctly and read the reject report instead of ignoring it.
OSMAINT imports equipment and inventory from semicolon-separated UTF-8 CSV, the same format as its exports, so export, edit and re-import round-trips. The import is row-by-row: a bad row is skipped and reported, and the rest are committed.
The order
- Organisation and sites.
- Functional locations.
- Equipment, with the Kod column as the required key.
- Inventory items and stock levels.
- PM schedules and job plans.
- Open work orders.
- Closed history, if you decided to keep it.
The equipment import
POST /api/import/equipment
Content-Type: text/csv; charset=utf-8
# semicolon-separated, header row required, column Kod is mandatory
# scope: equipment:write
The response reports imported, skipped and total, plus one error per rejected row with the row number and the raw data, so you can fix exactly those rows and re-upload. A duplicate code is skipped, not overwritten. A row with an unknown site name is rejected.
Reading the rejects
The reject file is the migration work queue. Do not re-run the whole import to fix three rows; fix the three rows and upload them. Because each row is independent and idempotent by code, a partial re-upload is safe.
There is no automatic rollback of an import. Take a database backup before the first load, and load into a staging instance before production.
Import a ten-row equipment file with one deliberately broken row. Confirm nine are imported, one is rejected with a row number, and the error message names the problem.
Terms
- Idempotent row
- A row that can be applied twice without creating a duplicate, here because the code is the key.
- Reject report
- The per-row error list returned by the import, used as the fix queue.
OSMAINT Academy · Data and migration · Load in dependency order · osmaint.org/academy/