BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Dunlin · Audit a parent and child table before import

Audit a table export for duplicate parents and orphaned child rows.

Audit a parent and child table before import

A child reference can look valid while the parent key is duplicated. Check uniqueness and referential integrity before a bulk import. The parent export repeats ID 1. Two child rows reference the missing ID 2.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-dunlin.git
cd blyx-dunlin
blyxc native-run project.blyx -- "1,1,3" "1,2,2"

API and return values

Returns [load acceptable, duplicate parent rows, orphan child rows, first orphan row]. This local check complements database-enforced constraints. Invalid input returns an empty vector.

ArgumentAccepted input
parentsVector of: exact signed integer
childrenVector of: exact signed integer

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
0
1
2
1
Open in the full playground →

Practice

Change parents = [1, 3], children = [3, 1]. Predict the result, then run the program.

Hint

Returns [load acceptable, duplicate parent rows, orphan child rows, first orphan row]. This local check complements database-enforced constraints.

Worked solution

The result vector is [1, 0, 0, -1]. Compare its fields with the return layout in the API section.

Find

    let parents = [1, 1, 3];

Replace with

    let parents = [1, 3];

Find

    let children = [1, 2, 2];

Replace with

    let children = [3, 1];

Output after the change

1
0
0
-1