4 min read

mssql.connector

Overview

The mssql.connector is a component designed to integrate Microsoft SQL Server (MSSQL) databases with the Vantage analytics and data platform. This connector allows users to execute SQL queries against MSSQL databases, retrieve the results, and handle any errors that may arise. It requires user authentication and the proper configuration of third-party services and credentials to function effectively.

Settings

The mssql.connector component accepts the following settings:

1. User Authentication

2. SQL Query

3. Service Configuration

4. Credentials Retrieval

5. Error Handling

How It Works

  1. The component begins by retrieving the user session to ensure that the user is authenticated.
  2. It checks that the inputs.query parameter is provided; if not, it throws an error indicating that the SQL query is required.
  3. Next, the connector attempts to find a configured MSSQL service associated with the authenticated user.
  4. The connector retrieves the encrypted credentials for the MSSQL service. If no credentials are found, the component returns an indication of failure.
  5. Upon successfully obtaining a valid service and credentials, the connector creates an integration instance using the node.
  6. It executes the provided SQL query in a read-only mode and returns the results.
  7. Any errors during execution are caught and displayed in a user-friendly format.

Data Expectations

The mssql.connector expects the following data inputs:

Use Cases & Examples

Use Case 1: Data Analysis

A data analyst needs to run reports based on historical sales data stored in an MSSQL database. They must query multiple records efficiently for their analysis.

Use Case 2: Data Migration

A database administrator is tasked with migrating data from an old application’s database to a new system. They can execute complex queries to extract the necessary data directly from the MSSQL database to facilitate this process.

Example Configuration

Assume a data migration use case where the administrator needs to extract a list of users from the MSSQL database to be imported into a new system. The specific SQL query might look like this:

json
{
    "inputs": {
        "query": "SELECT * FROM Users WHERE Status = 'Active'"
    },
    "config": {}
}

Breakdown

In conclusion, the mssql.connector serves as a robust interface for integrating and querying Microsoft SQL Server databases, providing essential features for authentication, error handling, and detailed configurations necessary for database interactions within the Vantage platform.