Skip to content

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.
Preview

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

FieldRequiredTypeDescriptionExample
credentials_pathTrueCREDENTIALSPath or reference to stored MySQL credentials used to authenticate requests.
timeoutTrueINTMaximum time in seconds to wait for the database helper actions before timing out.30
actionTrueSTRINGWhat 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_databaseTrueSTRINGThe database/schema to explore.sales_db
table_nameFalseSTRINGThe table to inspect or use for join suggestions. Required for 'get_table_columns' and 'suggest_joins'.orders
query_requirementsFalseSTRINGA 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_formatTrueSTRINGFormat 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

FieldTypeDescriptionExample
textSTRINGHuman-readable result text. Populated when output_format is 'text' or 'all'.Tables in Database: sales_db orders order_items customers ...
jsonJSONMachine-readable JSON containing the same information as the text output (e.g., lists of tables, columns, or join suggestions).{"tables":["orders","order_items","customers"]}
htmlHTMLHTML-formatted content for rendering in UI. Populated when output_format = 'html'.

Tables in Database: sales_db

orders\norder_items\ncustomers
xlsxXLSXExcel workbook bytes for export. Populated when output_format = 'xlsx'.
pdfPDFPDF 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.