5 min readUpdated Mar 2, 2026

dbQuery Logic Documentation

Overview

The dbQuery Logic component is designed to facilitate the retrieval of data from various connected databases within the Vantage analytics and data platform. Users can configure the database connection, formulate a query—either an SQL string for SQL databases or an operation object for NoSQL databases—and specify an optional limit on the number of rows the query should return. This Logic is integral for businesses needing to extract and manipulate data from their databases for further analysis or visualization.

Settings

The dbQuery Logic component comprises critical settings that allow users to tailor its behavior to their specific needs. Below is an exhaustive description of each configuration setting.

1. credentialRef

2. query

3. maxRows

How It Works

The dbQuery Logic operates by first validating and resolving the database credentials provided in the configuration. It then constructs an appropriate query based on the service type (SQL or NoSQL) and executes it against the connected database:

  1. The Logic retrieves the credentialRef and extracts the credentialId.
  2. It checks the validity of the credentials. If not found, or if they do not correspond to a valid database service, appropriate error messages are thrown.
  3. Based on the serviceKey, the Logic determines the type of database connection to initiate, either for SQL or NoSQL databases:
    • For SQL, it appends a LIMIT statement based on maxRows if necessary.
    • For NoSQL, it modifies the operation object passed in the query.
  4. Results from the query execution are normalized to a consistent array format.
  5. Finally, it ensures the database adapter is closed properly to prevent resource leakage.

Expected Data

The dbQuery component expects the following data types for its settings:

AI Integrations

Currently, the dbQuery component does not directly leverage AI integrations within its functionality. However, it can be a precursor to data that might later be processed by AI models or algorithms for analysis, predictions, or generating insights based on the queried results.

Billing Impact

Utilizing the dbQuery Logic may affect billing depending on various factors:

Use Cases & Examples

Use Case 1: Business Intelligence Reporting

A business analyst needs to generate monthly sales reports from a SQL database. They require specific customer data joined with sales data filtered by sales regions.

Use Case 2: Data Analysis for Machine Learning

Data scientists need to fetch specific records from a NoSQL store to train a machine-learning model. This involves querying for user behavior data.

Use Case 3: Real-Time Dashboard Updates

A company maintains a real-time dashboard that reflects user engagement metrics stored in a Firestore database and wishes to pull only the latest records.

Example Configuration

Use Case: Monthly sales reporting from a SQL database.

Sample Configuration:

json
{
  "credentialRef": {
    "strategy": "default",
    "credentialId": "123",
    "serviceKey": "db/connector/postgresql.adapter"
  },
  "query": "SELECT customer_id, SUM(sales_amount) as total_sales FROM sales WHERE sale_date >= '2023-01-01' AND sale_date < '2023-02-01' GROUP BY customer_id ORDER BY total_sales DESC",
  "maxRows": 100
}

In this example: