4 min readUpdated Mar 2, 2026

mysql.adapter Integration Documentation

Overview

The mysql.adapter integration is a component of the Vantage analytics and data platform designed to facilitate the connection and interaction with MySQL databases. It provides a comprehensive interface for executing queries, administering tables, and managing database connections securely and efficiently.

Purpose

The primary purpose of the mysql.adapter is to enable users to perform read and write operations within a MySQL database while ensuring data integrity and security. It allows for executing safe queries by filtering out unsafe SQL operations and supports both user-initiated read and write operations seamlessly.

How It Works

The mysql.adapter works by establishing a connection to a MySQL database using the mysql2/promise library to facilitate asynchronous query execution. The integration defines the following key functionalities:

Data Expectations

The adapter expects the following data from its integration settings:

Settings

The following are the detailed settings for the mysql.adapter:

Setting NameInput TypeDescriptionDefault Value
hostStringThe hostname or IP address of the MySQL database server. Changing this setting affects where the integration connects to retrieve data.Required
portNumericThe port number on which the MySQL server is listening for connections. If changed, this setting must match the server's configuration.Default is 3306
usernameStringThe username for authenticating against the MySQL database. If this username does not have permissions, queries will fail.Required
passwordStringThe password associated with the username for authentication. If set incorrectly, it will prevent access to the database.Required
databaseNameStringThe name of the specific database to connect to within the MySQL server. Changing this will determine which database is being queried.Required
sslBooleanIndicates whether to use SSL for secure connections. Setting this to true will enable SSL encryption on the connection.Default is false

Use Cases & Examples

Use Case 1: Data Reporting

A marketing team may want to generate reports from various tables in a MySQL database. By using mysql.adapter, they can run complex SELECT queries to retrieve aggregated data for analysis and visualization.

Use Case 2: Dynamic Table Management

An application that allows users to manage their product inventory may require creating tables dynamically. The mysql.adapter enables users to define and create new product tables based on changing business needs.

Use Case 3: Secure Data Manipulation

A finance team needs to insert transaction records while ensuring that no critical DDL commands (e.g., DROP, TRUNCATE) are executed inappropriately. The mysql.adapter enforces safe interactions through its validation processes.

Example Configuration

To illustrate how the mysql.adapter can be configured for a use case, consider a scenario where an application dynamically creates a table to manage user transactions. Here is a sample configuration data:

json
{
  "host": "192.168.1.1",
  "port": 3306,
  "username": "db_user",
  "password": "secure_password",
  "databaseName": "ecommerce_db",
  "ssl": true
}

In the application, the team could use mysql.adapter to create a new table for storing transactions as follows:

javascript
const mysqlAdapter = new MySQLAdapter(configurationData);
await mysqlAdapter.createTable('transactions', [
    { name: 'id', type: 'INT AUTO_INCREMENT', primaryKey: true, nullable: false },
    { name: 'user_id', type: 'INT', nullable: false },
    { name: 'amount', type: 'DECIMAL(10, 2)', nullable: false },
    { name: 'created_at', type: 'DATETIME', nullable: false, default: 'CURRENT_TIMESTAMP' }
]);

This operation creates a transactions table with specified columns and constraints, establishing a foundation for tracking user transactions securely.

Additional Notes

This comprehensive documentation provides a thorough understanding of the mysql.adapter integration, guiding users on its functionalities, configurations, and operational scenarios.