Skip to content

MySQL Principal Component

This component serves as the primary gateway for interacting with MySQL databases in your Nappai automation workflows. It allows you to securely connect to your database, run queries, manage data, and retrieve results seamlessly. Instead of writing complex code, you simply configure the connection, specify the actions you want to perform, and let the component handle the database communication behind the scenes.

How it Works

Inside the dashboard, this component acts as a smart bridge between your workflow and your MySQL database. When you connect it, it uses a pre-configured MySQL credential to establish a secure link. You then provide details like the table you want to work with, write or select queries, and set filters. The component processes these instructions, runs the appropriate database operations, and sends the results back to your workflow as structured data. It’s designed to be lightweight and reliable, automatically handling connection management and data formatting so you can focus on your automation logic.

Connection & Credentials

This component requires configuring a credential in the Nappai panel before interacting with the external service:

  1. Go to the Credentials section in your Nappai panel.
  2. Create a new credential of the type specified for this component and fill in the required fields (Connection Method, MySQL Server Connection URL, User, Password, Host, Port, Database).
  3. In your workflow, select the saved credential in the Credential input field of this node.

Inputs

Input Fields

The following fields are available to configure this component. Each field helps you define how the component interacts with your MySQL database:

  • Operation: Select the MySQL operation to perform.
  • Return All: Whether to return all results or only up to a given limit.
  • Table Name: Select the table to operate on.
  • Custom Query: Write your SQL query here. Examples include SELECT * FROM users WHERE age > 25, UPDATE products SET price = 100 WHERE id = 5, INSERT INTO customers (name, email) VALUES ('John', 'john@email.com'), and DELETE FROM users WHERE status = 'cancelled'. You can write multiple lines for complex queries.
  • Select Filter Type: Choose how to build your search conditions. String Mode is recommended for simple filters, allowing you to write conditions in a natural SQL-like style (e.g., age > 25 AND city = 'Madrid'). Build Manually Mode lets you use a visual form-based filter builder for complex conditions or multiple filters.
  • Filter String: Search conditions. Examples: age > 25 (Older than 25 years), name = 'Anna' AND city = 'Madrid' (Annas from Madrid), salary >= 30000 OR department = 'Sales' (Good salary OR from Sales). Rules: Put text in single quotes, leave numbers without quotes, use lowercase for booleans, and use uppercase for AND / OR connectors. If left empty in a Get operation, all records will be returned.
  • Limit: Number of results to return.
  • Filters: Number of filters to decide which rows are retrieved.
  • Field to Update: Number of fields to update.
  • Mode: Select how to insert data. Dynamic uses table columns automatically, while Custom allows you to use ingest data.
  • Ingest Data: Insert data into the database table.

Outputs

This component returns structured information that can be passed to other nodes for further processing, reporting, or automation.

Output Data Example (JSON)json

{ “Data”: { “records”: [ {“id”: 1, “name”: “John Doe”, “city”: “Madrid”, “status”: “active”}, {“id”: 2, “name”: “Anna Smith”, “city”: “Barcelona”, “status”: “pending”} ], “total_rows”: 2 }, “Database Info”: { “connection_status”: “active”, “version”: “8.0.35”, “server_name”: “nappai-main-db” } }

Connectivity

This component typically connects downstream to data transformation nodes, table viewers, or condition checkers. The Data output is ideal for feeding into reporting widgets, email triggers, or storage nodes that require specific records. Meanwhile, Database Info connects well to logging nodes, health check dashboards, or alerting systems that monitor connection status and database health.

Usage Example

Retrieving and Displaying Customer Records

  1. Connect the MySQL Principal Component to a valid MySQL credential in the Nappai panel.
  2. Set Table Name to customers.
  3. Choose Select Filter Type as “String Mode” and enter status = 'active' in Filter String.
  4. Set Return All to True and leave Limit blank.
  5. Connect the Data output to a Table Display node. The workflow will fetch all active customer records and display them in your dashboard.

Tips and Best Practices

  • Always test your SQL syntax in a database client before pasting it into Custom Query.
  • Use String Mode for straightforward filters to save time, and switch to Build Manually Mode when you need complex logic.
  • If working with large tables, set Return All to False and use Limit to prevent performance delays.
  • Keep your MySQL credentials updated in the Nappai panel to avoid unexpected workflow interruptions.

Security Considerations

  • Always rely on the provided filter fields or parameterized query methods to prevent SQL injection.
  • Restrict your MySQL user permissions to only the necessary read/write actions required by your workflow.
  • Avoid exposing connection strings or database credentials in shared or public workflows.
  • Regularly rotate credentials and monitor database access logs for unusual activity.