Documentation
Getting Started
Data Grid
Modeling
Business Rules
Approvals
Users, Roles & Security
Administration
Integration & API
Installation
Architecture
Documentation/Migrating from MDS/Migrate Master Data

Migrate Master Data

The second wizard loads the data rows from MDS into entities that already exist in Primentra. Run Migrate Models & Entities first.

Open Settings › Migration Wizards › Master Data Import, or click Import Data on the result screen of the first wizard.

The wizard has four steps: Instructions, Upload NDJSON, Preview and Done.

Step 1 — Export the data from MDS

  1. Copy the SQL script and save it as C:\Temp\export_mds.sql.
  2. Find sqlcmd.exe with the locate command the wizard shows.
  3. Run the sqlcmd command with your server and database name, writing to C:\Temp\import_data.ndjson.
  4. Click Next: Upload NDJSON.

The flags are the same as in the first wizard. -h -1 -y 0 -Y 0 are what keep long rows intact.

What the script does

The script loops over every entity that has a leaf member table and builds a SELECT for it:

  • Only active members are exported (Status_ID = 1), ordered by Code.
  • Every non-system attribute becomes a column. Code and Name are always included.
  • A domain attribute is joined to its target entity and exported as {Code} Name.
  • Rows are written in batches of 200 to stay under the 1 MB output limit of sqlcmd.
  • An attribute whose name contains a dot is exported under a placeholder name such as _pmtcol1, with the real name recorded in a columns map. FOR JSON PATH reads a dot as a nesting separator, and a name that starts or ends with a dot fails the whole export.

The output is NDJSON — one JSON object per line, one line per batch:

{"model":"Organisation","entity":"Zone","entityId":1,"rows":[{"Code":"Z001","Name":"North"}]}
{"model":"Organisation","entity":"Area","entityId":2,"rows":[{"Code":"A001","Name":"West","Zone":"{Z001} North"}]}
The export does not filter on the MDS version. If a model has more than one version, members of every version are exported.

Step 2 — Upload the NDJSON

Choose Choose .ndjson file, or paste the content. The wizard reads both NDJSON and a single JSON array from an older export, merges the batches of each entity back together, and restores any placeholder column names.

A line that sqlcmd cut off cannot be parsed. The wizard names the affected entities in a warning and continues with the rest. Re-export with the current script to fix it.

Step 3 — Choose an action per entity

Each entity in the file is matched to a Primentra entity by entity name and model name, ignoring case. The table then shows the rows to import, the rows already present, and a status:

StatusMeaning
emptyMatched, and the entity has no rows yet
has dataMatched, and the entity already has rows
no matchNo entity with that name in that model. The rows are skipped

Pick an action per entity:

ActionBehavior
ImportAdd rows. A row whose Code already exists is skipped
OverwriteMatch on Code, update those rows, add the rest
Delete + importDelete every existing row first, then import
SkipLeave the entity untouched

Overwrite and Delete + import are only offered for an entity that has data. The default is Import for an empty entity and Overwrite for one that has data. Import all, Overwrite all, Delete + import all and Skip all set every matched entity at once.

Delete + import removes referenced rows. Deleting a row that another entity points to clears that domain value in the other entity. Check your dependencies before you use it.

A yellow banner appears if any selected entity requires approval, because the import bypasses the approval workflow and writes directly.

Step 4 — Import

Primentra sorts the entities before it writes anything. It builds a dependency graph from the domain attributes and imports each parent before its children, so a domain value always finds its target. Entities in a dependency cycle are imported last.

Domain values

A domain value arrives as text and is resolved on the server in three passes:

  1. Exact match on Code.
  2. Exact match on Name.
  3. The code inside a {Code} Name string.

There is no partial matching. A value that matches nothing is dropped and the field stays empty, without a row-level warning. Check the domain columns after the import — see After Migration.

Progress

The import progress overlay with the overall percentage, the entity counter and the per-entity bar
The import progress overlay with the overall percentage, the entity counter and the per-entity bar(click to enlarge)

The overlay shows a percentage ring, an overall bar with "3 of 15 entities", and a bar for the entity being written with its row count. The per-entity bar is an estimate based on row count, so it moves at a different speed for a wide entity.

Cancel and rollback

Cancel stops the import after the entity in progress finishes. A part-written entity is never left behind.

Rollback empties the entity. Every entity already imported in this run is purged — including any rows that were there before the import started. Cancelling on entity 3 of 5 purges entities 1, 2 and 3. Entities 4 and 5 are never touched.

The preview screen then shows "Import cancelled. Rolled back N entities."

Step 5 — Done

The result screen reports Rows imported, Rows updated, Rows skipped and Entities cleared, with any warnings below. Each entity also gets an import entry in the Audit Log.

Limits

  • 50,000 rows per entity per import call.
  • Business rules never block the import. Rows that break a rule are written and reported afterwards.

Ready to get started?

Start managing your master data with Primentra today.

View Pricing
Migrate Master Data | Migrating from MDS | Docs | Primentra