5 min readUpdated Mar 2, 2026

dbWrite Logic Documentation

Overview

The dbWrite logic is a powerful component of the Vantage analytics and data platform. Its primary function is to write data to any connected database. Users can configure various settings to specify how data should be written, including the database selection, write operation, target table, and data mapping. This versatile node supports several databases, including SQL-based databases, MongoDB, Firestore, and others, making it suitable for wide-ranging applications in data management and analytics.

Settings

The dbWrite logic includes several settings, each playing a crucial role in determining how the data is written to the target database. Below is a comprehensive exploration of each setting:

1. Credential Reference (credentialRef)

2. Operation (operation)

3. Target Table (table)

4. Query (query)

5. Column Mapping (columnMapping)

6. Where Column (whereColumn)

How It Works

The dbWrite logic operates by utilizing the provided settings to establish a connection with the specified database using the credentials provided. It follows these steps:

  1. Credential Resolution: It first resolves the database credentials defined in the credentialRef setting to ensure valid connection parameters are available.
  2. Operation Execution: Based on the operation specified, it executes the relevant write operation, utilizing either SQL queries for relational databases or object queries for NoSQL databases like MongoDB.
  3. Data Handling: If batch processing is required (as specified through inputs and columnMapping), it processes the data into corresponding SQL or NoSQL commands before execution.
  4. Result Normalization: After executing the write operations, it normalizes the output to return a consistent response format.

Data Expectations

The dbWrite logic expects the following types of data:

Use Cases & Examples

Use Case 1: Customer Data Ingestion

A retail company wants to store incoming customer data from its e-commerce site into a relational database. Using the dbWrite, they can automatically insert new customer records whenever a new account is created without manual intervention.

Use Case 2: Inventory Management

A logistics company requires updates to its inventory records each time a shipment arrives or departs, dynamically updating quantities available in its database during runtime.

Example Configuration for a Customer Data Ingestion Use Case:

To achieve the goal of automatically inserting new customer records, the following setup may be used:

json
{
  "inputs": {
    "input1": {
      "data": [
        {
          "name": "John Doe",
          "email": "john@example.com",
          "phone": "123-456-7890"
        },
        {
          "name": "Jane Smith",
          "email": "jane@example.com",
          "phone": "987-654-3210"
        }
      ]
    }
  },
  "config": {
    "credentialRef": {
      "strategy": "API_KEY",
      "credentialId": "123456",
      "serviceKey": "db/connector/postgres"
    },
    "operation": "INSERT",
    "table": "customers",
    "columnMapping": {
      "name": "full_name",
      "email": "customer_email",
      "phone": "contact_number"
    }
  }
}

In this configuration:

This configuration would allow seamless integration of customer data into the database, enhancing operational efficiency.