Translate questions about e-mails into SQL queries and run them

Automated workflow: Translate questions about e-mails into SQL queries and run them. This workflow integrates 14 different services: convertToFile, stickyNote, agent, readWriteFile, merge. It contains 30 nodes and follows best practices for error handling and security.

Workflow Structure (24 nodes)
100%
Manual Trigger
When clicking "Test workflow"
Postgres
List all tables in a database
Postgres
List all columns in a table
Set
Add table name to output
Stop And Error
Error Handler
Convert To File
Convert data to binary
Read Write File
Save file locally
If
If ran manually
Postgres
Postgres
Set
Format query results
No Op
Chat Trigger
Execute Workflow Trigger
WorkflowTrigger
Read Write File
Load the schema from the local file
If
If file exists or already retried generating it
Extract From File
Extract data from file
Set
Combine schema data and chat input
No Op
AI Agent
No Op
Ollama Chat Model
Set
Extract SQL query
If
Check for trailing semicolon
Set
Add trailing semicolon
If
Check if query exists
Set
Format empty output
Merge
Combine query result and chat answer
Node Types:
transform
default
trigger
logic
action
Requires credentials

Prerequisites

No credentials required!

This workflow can be imported and used immediately.

Complexity

Complex

Advanced features used. Requires n8n experience.

Setup time: ~25 min
Score: 50/100
Conditional Logic
8 Integrations

When to Use This Workflow

Real-time Response

React instantly when events happen - new orders, form submissions, or API calls.

Zero delay between trigger and action for time-sensitive workflows.

Time Savings

Replace repetitive manual tasks with reliable automation.

Reclaim hours every week for higher-value work.

Error Reduction

Eliminate human error from routine processes with consistent automation.

Improve accuracy and reliability across your workflows.

workflow.json
{
  "id": "AC4paL1SXMFURgmc",
  "meta": {
    "instanceId": "workflow-df722e0b",
    "versionId": "1.0.0",
    "createdAt": "2025-09-29T07:07:51.394267",
    "updatedAt": "2025-09-29T07:07:51.394281",
    "owner": "n8n-user",
    "license": "MIT",
    "category": "automation",
    "status": "active",
    "priority": "high",
    "environment": "production"
  },
  "name": "Translate questions about e-mails into SQL queries and run them",
  "tags": [
    "automation",
    "n8n",
    "production-ready",
    "excellent",
...

Workflow Details

Nodes
27
Trigger
Event
Source
community
Added
Sep 29, 2025

Need Help?

Check out the official n8n documentation for detailed guides.

Related Workflows

Log errors and avoid sending too many emails

Automated workflow: Log errors and avoid sending too many emails. This workflow integrates 12 different services: postgr...

Postgres
Emailsend
Pushover
Executeworkflow
16 nodesEvent

🔥📈🤖 AI Agent for n8n Creators Leaderboard - Find Popular Workflows

Automated workflow: 🔥📈🤖 AI Agent for n8n Creators Leaderboard - Find Popular Workflows. This workflow integrates 19 d...

Http-request
Executeworkflow
Readwritefile
43 nodesEvent

🔥📈🤖 AI Agent for n8n Creators Leaderboard - Find Popular Workflows

Automated workflow: 🔥📈🤖 AI Agent for n8n Creators Leaderboard - Find Popular Workflows. This workflow integrates 19 d...

Http-request
Executeworkflow
Readwritefile
43 nodesEvent

SHEETS RAG

Automated workflow: SHEETS RAG. This workflow integrates 13 different services: stickyNote, googleDriveTrigger, code, lm...

Google-drive
Postgres
Google-sheets
Executeworkflow
24 nodesEvent

Youtube Searcher

Automated workflow: Youtube Searcher. This workflow integrates 11 different services: stickyNote, httpRequest, youTube,...

Http-request
Executeworkflow
Postgres
Youtube
21 nodesEvent

🤖🧑‍💻 AI Agent for Top n8n Creators Leaderboard Reporting

Automated workflow: 🤖🧑‍💻 AI Agent for Top n8n Creators Leaderboard Reporting. This workflow integrates 22 different s...

Http-request
Executeworkflow
Readwritefile
Schedule
49 nodesEvent