Dry run
Set dryRun: true to simulate the insertion process. This is useful for testing validation rules, checking conflict logic, and previewing which records would be created or updated without modifying your database.
Simulate an insertion
In this example, MantaHQ validates the URLs and checks for conflicts, but does not write any data to the table.
- Manta data table
- PostgreSQL
TypeScript
const preview = await manta.createRecords({
table: "products",
data: [
{ product_id: "P-A", name: "https://github.com" },
{ product_id: "P-B", name: "not-a-url" },
],
options: {
dryRun: true,
validationRule: { name: { format: "url" } }
},
});
TypeScript
const preview = await manta.createRecords({
db: 'inventory_pg',
table: "products",
data: [
{ product_id: "P-A", name: "https://github.com" },
{ product_id: "P-B", name: "not-a-url" },
],
options: {
dryRun: true,
validationRule: { name: { format: "url" } }
},
});
Dry run response
When dryRun is enabled, the API response includes a preview object. This object provides counts for wouldCreate, wouldUpdate, and wouldFail, allowing you to verify your batch logic before executing a live write.