MySQL Query Builder Helper¶
An interactive helper for exploring a MySQL database and scaffolding queries. It can list tables, inspect columns, suggest JOINs based on foreign keys, and produce simple query-building guidance from a natural language description. Results can be returned as plain text with JSON, or formatted as HTML/XLSX/PDF depending on the output choice.

Usage¶
Use this node when you need to understand a MySQL schema and quickly assemble queries without writing SQL from scratch. Typical workflow: authenticate with your MySQL credentials, choose an action (discover tables, get columns, suggest joins, or build query), optionally specify a target table, and select the desired output format for downstream nodes or export.
Inputs¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| credentials_path | True | CREDENTIALS | Path or reference to stored MySQL credentials used to authenticate requests. | |
| timeout | True | INT | Maximum time in seconds to wait for the database helper actions before timing out. | 30 |
| action | True | STRING | What to do: 'discover_tables' lists tables in the target database; 'get_table_columns' returns column metadata for a given table; 'suggest_joins' suggests JOIN clauses based on foreign keys; 'build_query' generates simple guidance from a natural language description. | discover_tables |
| target_database | True | STRING | The database/schema to explore. | sales_db |
| table_name | False | STRING | The table to inspect or use for join suggestions. Required for 'get_table_columns' and 'suggest_joins'. | orders |
| query_requirements | False | STRING | A natural language description of what data you want to retrieve. Used when action='build_query' to return guiding patterns. | List users with their last 3 orders and total spend this year |
| output_format | True | STRING | Format of the output. 'text' returns plain text plus JSON; 'html' returns an HTML block with JSON; 'xlsx' produces an Excel file with JSON; 'pdf' produces a PDF with JSON; 'all' behaves like text for this helper. | text |
Outputs¶
| Field | Type | Description | Example |
|---|---|---|---|
| text | STRING | Human-readable result text. Populated when output_format is 'text' or 'all'. | Tables in Database: sales_db orders order_items customers ... |
| json | JSON | Machine-readable JSON containing the same information as the text output (e.g., lists of tables, columns, or join suggestions). | {"tables":["orders","order_items","customers"]} |
| html | HTML | HTML-formatted content for rendering in UI. Populated when output_format = 'html'. | Tables in Database: sales_dborders\norder_items\ncustomers |
| xlsx | XLSX | Excel workbook bytes for export. Populated when output_format = 'xlsx'. | |
| PDF document bytes for export. Populated when output_format = 'pdf'. |
Important Notes¶
- Action requirements: 'get_table_columns' and 'suggest_joins' require 'table_name'; 'discover_tables' and 'build_query' do not.
- Join suggestions are based on information_schema foreign key metadata; if no foreign keys exist or permissions are limited, suggestions may be empty.
- The 'build_query' action provides generic patterns and guidance, not a fully generated SQL query.
- Output population depends on 'output_format': only the corresponding output fields are filled; others are empty strings.
- Ensure credentials are valid and the user has sufficient privileges to access information_schema and target databases/tables.
Troubleshooting¶
- No results for 'discover_tables': Verify 'target_database' exists and the credentials have permissions to list tables.
- Empty or missing JOIN suggestions: Confirm foreign keys are defined in the schema and accessible via information_schema with current permissions.
- Error: 'Table name is required' for certain actions: Provide 'table_name' when using 'get_table_columns' or 'suggest_joins'.
- Timeouts or connectivity errors: Increase 'timeout', verify host/network access, and confirm credentials are correct.
- Unexpected output format behavior: Check 'output_format' value; only the matching output field is populated for html/xlsx/pdf modes.