← All N8N workflows
AI & researchAgentCodeIfLM Chat Deep SeekLM Chat Google Gemini

nl2sql

Configured with Agent, LM Chat Deep Seek, LM Chat Google Gemini, Memory Buffer Window, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
AI & modelsAI AgentAgentAI & modelsDeepSeek Chat ModelLM Chat Deep SeekWeb / APIReturn Final ResponseRespond To WebhookTriggerWebhookWebhookCodeFormat Success ResultCodeData storeChat Memory ManagerMemory ManagerCodeFormat HistoryCodeAI & modelsDeepSeek Chat Model1LM Chat Deep SeekCodeFormat ChartsCodeAI & modelsCharts AgentAgentTransformLoop EntryEdit FieldsRoutingIf Can RetryIfCodeFormat Error PromptCodeRoutingIf ErrorIfData storeSearch MemoryMemory Buffer WindowCodeExtract User InputCodeData storeGet DB SchemaPostgresCodeFormat SchemaCodeCodePrepare Initial PromptCodeData storeExecute Generated SQLPostgresData storeInsert MemoryMemory Buffer WindowRoutingIf ChartsIfRoutingIf Ai ErrorIfAI & modelsGoogle Gemini ChatModelLM Chat Google Gemini

Node categories in this workflow

  • AI & models
  • Web / API
  • Trigger
  • Code
  • Data store
  • Transform
  • Routing

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
AI AgentAI & modelsAgentSee node parameters
DeepSeek Chat ModelAI & modelsLM Chat Deep SeekSee node parameters
Return Final ResponseWeb / APIRespond To WebhookSee node parameters
WebhookTriggerWebhookSee node parameters
Format Success ResultCodeCodeSee node parameters
Chat Memory ManagerData storeMemory ManagerSee node parameters
Format HistoryCodeCodeSee node parameters
DeepSeek Chat Model1AI & modelsLM Chat Deep SeekSee node parameters
Format ChartsCodeCodeSee node parameters
Charts AgentAI & modelsAgentSee node parameters
Loop EntryTransformEdit FieldsSee node parameters
If Can RetryRoutingIfSee node parameters
Format Error PromptCodeCodeSee node parameters
If ErrorRoutingIfSee node parameters
Search MemoryData storeMemory Buffer WindowSee node parameters
Extract User InputCodeCodeSee node parameters
Get DB SchemaData storePostgresexecuteQuery
Format SchemaCodeCodeSee node parameters
Prepare Initial PromptCodeCodeSee node parameters
Execute Generated SQLData storePostgresexecuteQuery
Insert MemoryData storeMemory Buffer WindowSee node parameters
If ChartsRoutingIfSee node parameters
If Ai ErrorRoutingIfSee node parameters
Google Gemini Chat ModelAI & modelsLM Chat Google GeminiSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • deepSeekApi
  • googlePalmApi
  • postgres

Workflow notes

自然语言 AI SQL查询

自然语言 AI SQL查询

  1. AI首次尝试生成SQL。
  2. 执行SQL,如果成功,则返回结果。
  3. 如果失败,将错误信息反馈给AI,让其修正。
  4. 最多重试3次,如果依然失败,则返回最终错误信息。
nl2sql

nl2sql

Purpose and structure

This folder contains the nl2sql workflow. Its executable nodes use agent, code, if, lmChatDeepSeek, lmChatGoogleGemini, memoryBufferWindow, memoryManager, postgres, respondToWebhook, set, webhook. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Webhook

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Wilsonoonn/n8n_nl2sql/blob/fa7c4204d690b1817aa4f916267d8a2f48c5c136/nl2sql.json Apache-2.0; preserve source notices.

More in AI & research