Actions20
- AI Scrape Actions
- Analyze Sentiment Actions
- Convert to SQL Actions
- Generate Embedding Actions
- HTML to Any Actions
- Image Generation Actions
- Make Prediction Actions
- NSFW Detection Actions
- Object Detection Actions
- Process Image Actions
- Profanity Detection Actions
- Search Web Actions
- Spam Detection Actions
- Speech to Text Actions
- Spell Check Actions
- Summary Actions
- Text to Speech Actions
- Translate Actions
- Translate Image Actions
- Web Suggestion Actions
Overview
The "Convert to SQL" operation in this node translates a natural language prompt into an SQL query tailored for a specific database type. This is useful when users want to generate SQL queries without manually writing them, especially if they are not familiar with SQL syntax or the underlying database schema.
Common scenarios include:
- Quickly generating complex SQL queries from plain English descriptions.
- Assisting non-technical users in querying databases.
- Automating report generation by converting user requests into executable SQL.
- Supporting multiple database types (PostgreSQL, MySQL, SQLite) with appropriate syntax.
For example, a user could input:
“Find all transactions with amounts exceeding $10,000, sorted by transaction date”
and receive a valid SQL query for their chosen database.
Properties
Name | Meaning |
---|---|
Prompt | The natural language description that will be converted into an SQL query. |
Database Type | The target database system for which the SQL query should be generated. Options: PostgreSQL, MySQL, SQLite. |
Prompt Source | The source of the prompt context used to assist conversion. Options: SQL Schema, File Store Key. |
SQL Schema | The database schema definition provided as a string, used when "SQL Schema" is selected as the prompt source. |
File Store Key | A key referencing stored database schema information in a file storage system, used when "File Store Key" is selected as the prompt source. |
Output
The node outputs JSON data containing the generated SQL query based on the input prompt and selected database type. The output structure typically includes:
json
: An object with fields such as:- The generated SQL query string.
- Possibly metadata about the query or processing status.
No binary data output is indicated for this operation.
Dependencies
- Requires an API key credential to authenticate with the JigsawStack API service.
- The node sends requests to the JigsawStack API endpoint at
https://api.jigsawstack.com/v1
. - Proper configuration of the API key credential within n8n is necessary.
- If using "File Store Key" as the prompt source, the referenced schema must be previously stored and accessible via the file storage system integrated with JigsawStack.
Troubleshooting
- Missing or invalid API key: The node requires a valid API key credential. Ensure the API key is correctly configured in n8n credentials.
- Incorrect prompt format: The natural language prompt must be clear and descriptive enough for accurate SQL generation.
- Unsupported database type: Only PostgreSQL, MySQL, and SQLite are supported. Selecting an unsupported type may cause errors.
- Schema access issues: When using "File Store Key", ensure the key is correct and the schema file exists in the file storage.
- API errors: Network issues or API downtime can cause failures. Check connectivity and API status.
- Empty or invalid schema: Providing an empty or malformed schema string may lead to incorrect or failed SQL generation.
Links and References
- JigsawStack API Documentation (hypothetical link for reference)
- SQL syntax references for PostgreSQL, MySQL, and SQLite for understanding generated queries.