Skip to content

MySQL Visual Query Builder

Builds and executes MySQL SELECT queries using a visual-style configuration instead of raw SQL. Supports JOINs (INNER, LEFT, RIGHT, FULL, CROSS), WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, and OFFSET. Can output results in multiple formats including plain text/JSON, HTML, XLSX, and PDF.
Preview

Usage

Use this node when you want to query MySQL data without hand-writing SQL, or when you need to construct complex multi-table queries with joins in a structured way. Typical workflow: provide credentials, choose the main table and database, specify selected columns and optional joins/filters/ordering, then pick the desired output format for downstream reporting or export.

Inputs

FieldRequiredTypeDescriptionExample
credentials_pathTrueSTRINGReference/path to stored MySQL credentials to authenticate requests.secrets/mysql-prod.json
timeoutTrueINTMaximum time in seconds to wait for the query to execute before failing.120
main_tableTrueSTRINGPrimary table to query from.users
databaseTrueSTRINGDatabase name that contains the main table.salesdb
selected_columnsTrueSTRINGColumns to include in the SELECT clause. Use comma-separated columns or '*' for all columns. Supports qualified names (e.g., users.id, orders.total).users.id, users.name, orders.total
join_configTrueSTRINGJSON array (as a string) describing JOINs. Each item must include 'type', 'table', and 'on'. Optional 'database' defaults to 'mysql' if omitted.[{"type":"INNER","table":"orders","database":"salesdb","on":"users.id = orders.user_id"}]
where_conditionsFalseSTRINGText for the WHERE clause without the 'WHERE' keyword.users.status = 'active' AND orders.total > 100
group_by_columnsFalseSTRINGComma-separated columns for GROUP BY.users.country
having_conditionsFalseSTRINGText for the HAVING clause without the 'HAVING' keyword (used with GROUP BY).COUNT(orders.id) > 2
order_by_columnsFalseSTRINGComma-separated ORDER BY columns. Append DESC for descending order if needed.users.created_at DESC, users.id ASC
limit_countTrueINTMaximum number of rows to return. Must be >= 1.100
offset_countTrueINTNumber of rows to skip before returning results. Must be >= 0.0
output_formatTrueSTRINGResult output format. One of: text, html, xlsx, pdf, all.all

Outputs

FieldTypeDescriptionExample
textSTRINGHuman-readable summary of the query results. Populated when output_format is 'text' or 'all'.Visual Query: salesdb.users — 100 rows returned
jsonJSONRaw results as JSON (typically includes a 'data' array and optional metadata). Always populated on success.{"data":[{"id":1,"name":"Alice","total":250.0}]}
htmlHTMLHTML table representation of the results. Populated when output_format is 'html' or 'all'.
idnametotal
1Alice250.0
xlsxXLSXExcel workbook bytes of the results. Populated when output_format is 'xlsx' or 'all'.
pdfPDFPDF document bytes containing a tabular rendering of the results. Populated when output_format is 'pdf' or 'all'.

Important Notes

  • JOIN types: Supported join types are INNER, LEFT, RIGHT, FULL, and CROSS. Any other value will be rejected.
  • Join configuration format: join_config must be a JSON array string. Each join requires 'type', 'table', and 'on'. 'database' is optional and defaults to 'mysql'.
  • SQL assembly: The node constructs a SQL query from your inputs. Ensure where_conditions, having_conditions, and order_by_columns are valid SQL fragments.
  • Limits and offsets: LIMIT is included only if limit_count > 0; OFFSET only if offset_count > 0.
  • Output selection: Choose 'all' to get text, JSON, HTML, XLSX, and PDF simultaneously. Other formats return only the requested artifact plus JSON.
  • Empty results: If no rows are returned, the text output will indicate no data; JSON output will return an empty data array.
  • Security: Avoid injecting sensitive values directly in conditions. Store secrets in credentials and do not include passwords in inputs.

Troubleshooting

  • Invalid join_config JSON: If parsing fails, ensure join_config is valid JSON (as a string) and is an array of objects. Example: "[{\"type\":\"INNER\",\"table\":\"orders\",\"on\":\"users.id = orders.user_id\"}]"
  • Unsupported join type: Error indicating invalid join type means 'type' must be one of INNER, LEFT, RIGHT, FULL, CROSS.
  • SQL syntax errors: If the database reports a syntax error, review where_conditions, having_conditions, order_by_columns, and selected_columns for mistakes or missing qualifiers.
  • Unknown columns/tables: Ensure selected_columns, join 'table', and column references exist and are correctly qualified with table names when necessary.
  • No data returned: Verify filters in where_conditions and having_conditions aren't over-restrictive; try removing filters or increasing limit_count.
  • Permission/connection errors: Confirm credentials_path points to valid MySQL credentials with required permissions and that the timeout is sufficient.
  • Empty HTML/XLSX/PDF outputs: These are only populated when output_format matches the format or is 'all'. Set output_format accordingly.