Skip to content

MySQL

The MySQL component lets you read from, write to, or get information about a MySQL database right inside your Nappai dashboard.
It connects to a database that you’ve already set up in Nappai’s credentials, so you don’t have to type passwords or connection strings each time.

How it Works

When you drop the MySQL component into a workflow, it uses the MySQL credential you selected to open a secure connection to the database.
Depending on the operation you choose, it will either:

  • Add – Insert new rows into a table, optionally dropping the table first.
  • SQL – Run any SQL statement you write and return the result set.
  • DatabaseInfo – Pull metadata about the database (tables, columns, etc.).

All communication happens over the standard MySQL protocol, so the component behaves like any other database tool but inside the visual workflow editor.

Operations

This component offers several operations that you can select based on what you need to do. You can only use one operation at a time:

  • Add: Insert new rows into a specified table.
  • SQL: Execute a custom SQL query and return the results.
  • DatabaseInfo: Retrieve information about the database schema and tables.

To use the component, first select the operation you need in the “Operation” field.

Inputs

Before using this component, make sure you have created a MySQL credential in Nappai’s credentials section. Then select that credential in the Credential field of this component.

Input Fields

The following fields are available to configure this component. Each field may be visible in different operations:

  • Credential: Select a previously configured MySQL credential.

    • Visible in: Add, SQL, DatabaseInfo
  • Ingest Data: Insert data into the database table.

    • Visible in: Add
  • Operation: Choose which operation to run.

    • Visible in: Add, SQL, DatabaseInfo
  • Search Query: SQL query to execute.

    • Visible in: SQL
  • Table Name: Name of the table in the database.

    • Visible in: Add
  • Drop Table: Drop the table if it exists before inserting data.

    • Visible in: Add, DatabaseInfo

Outputs

  • Data: The result set returned from a SQL query or the data that was inserted.
  • Database Info: Metadata about the database, such as tables and columns.

These outputs can be connected to other components to build more complex workflows.

Usage Example

Example 1 – Adding Data

  1. Drag the MySQL component into your workflow.
  2. Set Operation to Add.
  3. Choose your Credential.
  4. Enter the Table Name (e.g., customers).
  5. In Ingest Data, paste a JSON array of rows you want to insert.
  6. (Optional) Check Drop Table if you want to start fresh.
  7. Connect the Data output to a “Log” component to see the inserted rows.

Example 2 – Running a Custom Query

  1. Drag the MySQL component into your workflow.
  2. Set Operation to SQL.
  3. Choose your Credential.
  4. In Search Query, write:
    SELECT * FROM orders WHERE status = 'shipped';
  5. Connect the Data output to a “Table” component to display the results.
  • Database Connector – A generic component for connecting to various database types.
  • Data Formatter – Helps shape and clean data before sending it to MySQL.
  • Log – Useful for inspecting the output of the MySQL component.

Tips and Best Practices

  • Use “Drop Table” only when you’re sure you want to delete existing data.
  • Keep your SQL queries short and test them in a database client first to avoid accidental data loss.
  • Reuse credentials: Create one MySQL credential and use it across multiple components to keep your workflow tidy.
  • Validate input data before sending it to the database to prevent errors.
  • Use the “Database Info” operation to explore the schema before writing queries.

Security Considerations

  • The MySQL credential stores the host, port, database name, user, and password securely in Nappai.
  • Never expose the credential details in the workflow; they are hidden from the UI.
  • Use SSL/TLS if your MySQL server supports it to encrypt traffic.
  • Restrict database permissions for the user in the credential to only the tables and actions your workflow needs.

By following these guidelines, you can safely and efficiently interact with your MySQL databases from within Nappai.