Conversing with data: transforming text into SQL queries and visual curves
Needs changesWhat this workflow does
This AI workflow has 25 nodes and runs manually, when you click “Execute workflow” (plus 1 other trigger). Along the way it connects Postgres and OpenAI Chat Model.
How it runs
Trigger: Manually, when you click “Execute workflow” (plus 1 other trigger).
- List all tables in a database (Postgres): uses Postgres
- Load the schema from the local file (Read/Write Files from Disk): reads a file from disk
- Schema Extractor (Postgres): uses Postgres
- Extract data from file (Extract from File): extracts data from a file
- Add table name to output (Edit Fields (Set)): sets or maps fields
- Combine schema data and chat input (Edit Fields (Set)): sets or maps fields
- Convert data to Json (Convert to File): converts data to a file
- AI Agent: runs an AI agent, with model: Deepseek-chat; memory: Window Buffer Memory
- Save file locally (Read/Write Files from Disk): reads a file from disk
- Extract SQL query (Edit Fields (Set)): sets or maps fields
…plus 8 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in AI Agent (v1.6), plot agent (v1.7): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI Agent (v1.6), plot agent (v1.7) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (14)
- Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - No Operation, do nothing
n8n-nodes-base.noOp - Edit Fields (Set)
n8n-nodes-base.set - Read/Write Files from Disk
n8n-nodes-base.readWriteFile - Extract from File
n8n-nodes-base.extractFromFile - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - AI Agent
@n8n/n8n-nodes-langchain.agent - Manual Trigger
n8n-nodes-base.manualTrigger - If
n8n-nodes-base.if - Merge
n8n-nodes-base.merge - Postgres
n8n-nodes-base.postgres - Convert to File
n8n-nodes-base.convertToFile - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
From the author
Conversational Data Retrieval and Visualization Workflow This workflow enables users to interact with a PostgreSQL database using natural language. It translates text inputs into SQL queries, retrieves the corresponding data, and generates visualizations…