Syntax
First, import the MantaClient from the library, see Getting Started:
Parameters
The createRecords() method object can contain the following properties:
Per-row validation
You can define custom validation rules for individual records by including a validation object inside the data item. These per-row rules will be applied in addition to any global validationRule defined in the options object.
Upsert & conflicts
Use the upsert: true option to handle conflicts by updating existing records instead of creating a duplicate. When you enable upsert, you must provide conflictKeys to tell MantaHQ which fields to use to identify a match (for example, a unique ID or an email address).
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.
Error handling
Validation errors
Examples
For all examples below, to create records in an external PostgreSQL database, include the db parameter with your connection name. If omitted, Manta defaults to its internal storage.