Skip to main content

Query your PostgreSQL data in plain English with GPT-4o-mini

Workflow preview

Workflow preview
100%
Query your PostgreSQL data in plain English with GPT-4o-mini preview
Open on n8n.io

1. Workflow Overview

AI SQL Analytics Agent Chat With Any PostgreSQL Database Using Natural Language This template turns your PostgreSQL database into an AI powered analytics assis...

Best for

  • Market Research automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.chattrigger, n8n-nodes-base.code, n8n-nodes-base.if, n8n-nodes-base.postgres, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.memorypostgreschat

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Bhautik Trambadia.

Original n8n.io source

1.1 Workflow description

Title
Query your PostgreSQL data in plain English with GPT-4o-mini
Workflow name
Query your PostgreSQL data in plain English with GPT-4o-mini

AI SQL Analytics Agent

Chat With Any PostgreSQL Database Using Natural Language

This template turns your PostgreSQL database into an AI-powered analytics assistant.

Instead of exporting data or uploading huge CSV files to an LLM, this workflow lets AI query your database directly using SQL, returning clean insights instantly.

Just type your table name once and start asking questions in plain English.

No SQL required.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Chat Trigger

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.4

Block 2 - Manage Table Name

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - Need Schema?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 4 - Fetch Schema

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 5 - Format Schema

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Empty Schema

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 7 - Unified Analytics Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3.1

Block 8 - OpenAI GPT-4o-mini

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.3

Block 9 - Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryPostgresChat - memoryPostgresChat
Config choices
Version 1.3

Block 10 - Execute SQL Query

Type / Role
n8n-nodes-base.postgresTool - postgresTool
Config choices
Version 2.5

Block 11 - Manual Trigger

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 12 - ⚙️ Config (Sync)

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 13 - Fetch Google Sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 14 - Insert Rows to Postgres

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 15 - Truncate Table

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 16 - QuickChart

Type / Role
n8n-nodes-base.quickChartTool - quickChartTool
Config choices
Version 1

Block 17 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Query your PostgreSQL data in plain English with GPT-4o-mini
Complexity advanced
Nodes 22
Categories Market Research, AI Chatbot
Author Bhautik Trambadia
Published 15 Mar 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14057/14057.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Query your PostgreSQL data in plain English with GPT-4o-mini do?

AI SQL Analytics Agent Chat With Any PostgreSQL Database Using Natural Language This template turns your PostgreSQL database into an AI powered analytics assis...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Market Research, AI Chatbot use case.