PostgreSQL Query Builder Helper¶
Interactive helper for exploring a PostgreSQL schema and drafting queries. It can list tables, show a table’s columns, suggest JOIN relationships based on foreign keys, and provide starter SQL patterns from a natural-language requirement. Results can be returned as text/JSON, or exported as simple HTML/XLSX/PDF summaries.

Usage¶
Use this node early in your database workflow to understand schema structure and plan queries. Typical flow: start with discover_tables to see what’s available, then get_table_columns for details on a specific table, use suggest_joins to identify relationships, and finally build_query to generate starter query ideas from a plain-English description. Pair it with a query execution or visual query node to run or refine the SQL.
Inputs¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| credentials_path | True | STRING | Database connection URI for PostgreSQL. | postgresql:// |
| timeout | True | INT | Request timeout in seconds for service operations. | 60 |
| action | True | SELECT | What helper action to perform. | discover_tables |
| target_schema | True | STRING | Schema to explore for tables, columns, and relationships. | public |
| table_name | True | STRING | Table name used when action is get_table_columns or suggest_joins. | users |
| query_requirements | True | STRING | Natural-language description of the data you want, used when action is build_query. | List users and their orders with total amounts this month |
| output_format | True | SELECT | Choose how the helper results are returned or exported. | text |
Outputs¶
| Field | Type | Description | Example |
|---|---|---|---|
| result | STRING | Human-readable summary text of the helper result (tables, columns, join suggestions, or query patterns). | Tables in schema 'public' (12 tables): - users - orders - products ... |
| json_result | STRING | JSON string containing the structured result (e.g., lists of tables, column metadata, or join suggestions). | {"tables": ["users", "orders", "products"]} |
| html_table | STRING | HTML content containing a simple formatted view of the helper result (populated when output_format=html). | ... |
| xlsx_data | STRING | Base64-encoded XLSX file with a simple export of the helper result (populated when output_format=xlsx). | |
| pdf_data | STRING | Base64-encoded PDF with a simple export of the helper result (populated when output_format=pdf). |
Important Notes¶
- Table name is required when using get_table_columns or suggest_joins; otherwise, an error is returned.
- build_query provides template suggestions based on your description; it does not generate or execute a final SQL statement.
- discover_tables and get_table_columns rely on the connected database’s metadata; ensure permissions grant access to information_schema/catalogs.
- output_format controls which of the export fields are populated. For html/xlsx/pdf, only that format (plus JSON) is filled; selecting all is not supported for this helper and will return primarily text and JSON.
- The node requires a valid PostgreSQL URI in credentials_path. Invalid or unsupported URI formats will cause validation errors.
- XLSX and PDF outputs are base64-encoded strings intended for downstream save/export nodes.
Troubleshooting¶
- Invalid credentials URI: Ensure credentials_path uses a valid PostgreSQL URI format like postgresql://
: @ :5432/ ?schema=public - Table name required: For get_table_columns or suggest_joins, provide table_name; otherwise the node returns an error.
- No foreign key relationships found: suggest_joins may return a message indicating none were found. Verify constraints exist or check the correct schema.
- Timeouts or connection errors: Increase timeout, verify network connectivity, and confirm the database service is reachable with your credentials.
- Empty or minimal output in html/xlsx/pdf: These exports summarize the helper results; they are not full query result sets. For data exports, run the actual query with a query execution node.