MySQL Query Builder Helper¶
Assists with interactive MySQL query building and schema discovery. It can list tables, fetch table columns, suggest possible JOINs using foreign key relationships, and generate starter query suggestions from a natural language description. Results can be returned as text/JSON or exported to HTML, XLSX, or PDF, depending on the chosen output format.

Usage¶
Use this node when you want to explore a MySQL database and iteratively build queries without writing SQL from scratch. Typical workflow: first discover_tables to see available tables, then get_table_columns for structure, use suggest_joins to identify relationships, and finally build_query to get example SQL patterns based on your requirements. Provide valid MySQL credentials and select an output_format appropriate for your downstream nodes.
Inputs¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| credentials_path | True | STRING | Path or reference to stored MySQL credentials to authenticate requests. | /credentials/mysql/default.json |
| timeout | True | INT | Maximum time (in seconds) to wait for the database service to respond. | 60 |
| action | True | CHOICE | What to do: discover tables, get table columns, suggest joins, or build a query from a description. | discover_tables |
| target_database | True | STRING | The database (schema) to explore. | sales_db |
| table_name | True | STRING | Target table when action is get_table_columns or suggest_joins. Ignored for discover_tables and build_query. | orders |
| query_requirements | True | STRING | Natural language description of what you want to retrieve. Used when action is build_query. | List customers and their total order amounts in the last 30 days, sorted by total descending |
| output_format | True | CHOICE | Result format. text returns formatted text plus JSON; html returns an HTML block; xlsx returns an Excel file; pdf returns a PDF; all returns a combined set when applicable. | text |
Outputs¶
| Field | Type | Description | Example |
|---|---|---|---|
| text | STRING | Human-readable summary or suggestions, populated when output_format is text (and may be included for all in some cases). | Tables in Database: sales_db orders customers order_items |
| json | STRING | Machine-readable JSON string with the raw data (e.g., tables, columns, or join suggestions). | {"suggestions": ["JOIN orders ON customers.id = orders.customer_id"]} |
| html | HTML | HTML-rendered content (e.g., a formatted block with the result), populated when output_format is html. | Tables in Database: sales_dborders\ncustomers |
| xlsx | XLSX | Excel file bytes containing the result, populated when output_format is xlsx. | |
| PDF file bytes containing the result, populated when output_format is pdf. |
Important Notes¶
- Table name is required when action is get_table_columns or suggest_joins; leave it empty for discover_tables or build_query.
- Join suggestions are inferred from foreign key relationships via information_schema; the database user must have permissions to read metadata.
- output_format controls which output ports are populated. For text, you’ll receive a formatted text plus a JSON string; for html/xlsx/pdf, the respective output will be filled along with JSON.
- Provide a valid credentials_path configured for MySQL; the node uses it to authenticate against the database service.
- The build_query action returns example SQL patterns and guidance derived from your query_requirements; it does not automatically execute SQL.
Troubleshooting¶
- Action requires table_name: If you get an error using get_table_columns or suggest_joins, ensure table_name is set (e.g., "orders").
- No join suggestions returned: The table may not have foreign key relationships, or your user lacks metadata permissions on information_schema. Verify constraints and permissions.
- Empty discovery results: Confirm target_database exists and the credentials have access. Try discover_tables with a different database or check permissions.
- Timeouts or connection errors: Increase timeout, verify network access to the database service, and confirm credentials_path points to valid MySQL credentials.
- Invalid output format: Ensure output_format is one of text, html, xlsx, pdf, or all.