otimport
Loads a bundle of DCIM site data under one tenant.
The bundle is a directory of site data. otimport reads it and loads every site under the tenant you name.
Inserts are create-only. The importer does not update existing rows, so a second run over the same data adds nothing it could overwrite.
When the run ends, otimport writes a report to the report directory.
otimport load --tenant <TENANT> --bundle <DIR> --report-dir <DIR>Options
-
--tenantThe tenant that owns every row the import creates.
-
--bundleDirectory containing the bundle of site data to load.
-
--report-dirDirectory where the import report is written.
Behavior
-
One import per tenant at a time
otimport takes a per-tenant advisory lock for the whole run. If another import holds the lock, otimport exits with code 6 and names the holder.
Why Two imports for one tenant that interleave could each see half of the other's rows. A lock makes the second run wait for a clear answer instead of producing a mixed result.
-
Refuses a privileged database role
otimport will not run as a database superuser or as any role that bypasses row-level security. It exits with code 2.
Why The import is deliberately subject to the same tenant isolation as every other write. A role that bypasses row-level security would make the importer the one component that could write across tenants.
-
Per-site row ceiling
otimport enforces a ceiling on rows per site and refuses an oversized site before it loads anything from it.
Why Rejecting up front is cheaper and safer than discovering the limit halfway through a transaction.
-
First failure stops the run
The run stops at the first failure and records which site failed. Sites that were partially loaded are not committed.
Why A half-loaded site is harder to reason about than a missing one. Stopping early keeps the committed data a set of complete sites.
States
| State | Meaning |
|---|---|
running | The import run has started and is working through the bundle. |
loading | A site is being loaded. |
finished | The site has loaded without error and is waiting to be committed. |
committed | The site's rows are durable. |
failed | The run or site failed. The record names the site that stopped the run. |
Exit codes
| Code | Meaning | What to do |
|---|---|---|
0 | Success. | Nothing. The report is in the report directory. |
2 | Refused: the database role is too privileged. | Run with a role that is not a superuser and does not bypass row-level security. |
6 | Another import holds the tenant lock. | Read the holder named in the output. Wait for that import to end, then run again. |
Other nonzero | A failure. | The report describes the failure and names the site that stopped the run. |
Examples
docker exec <control-plane-container> \
otimport load \
--tenant <TENANT> \
--bundle /path/inside/container/bundle \
--report-dir /path/inside/container/reports