Translate questions about e-mails into SQL queries and run them
Triggered manually or by an app event. Connects Condition, Convert To File, Extract From File, PostgreSQL, Read Write File, Stop And Error. This can run manually This section: loads a list of all tables from the database extracts the database schema for each table and adds the table name converts the schema into a binary JSON format saves the schema file locally This is triggered by chat or as a s
Front matter
name: Translate questions about e-mails into SQL queries and run them
description: Triggered manually or by an app event. Connects Condition, Convert To File, Extract From File, PostgreSQL, Read Write File, Stop And Error. ## This can run manually This section: * loads a list of all tables from the database * extracts the database schema for each table and adds the table name * converts the schema into a binary JSON format * saves the schema file locally ## This is triggered by chat or as a sub-workflow Natural language requests can be asked, and a SQL query as well as its results will be returned. ## Quite the prompt 😅 Some refined prompt engineering work here. It may or may not been done aided by Kagi's Assist
category: Automation
kind: Workflow
software: Condition|Convert To File|Extract From File|PostgreSQL|Read Write File|Stop And ErrorTranslate questions about e-mails into SQL queries and run them
Triggered manually or by an app event. Connects Condition, Convert To File, Extract From File, PostgreSQL, Read Write File, Stop And Error. ## This can run manually This section:
- loads a list of all tables from the database
- extracts the database schema for each table and adds the table name
- converts the schema into a binary JSON format
- saves the schema file locally ## This is triggered by chat or as a sub-workflow
Natural language requests can be asked, and a SQL query as well as its results will be returned. ## Quite the prompt 😅 Some refined prompt engineering work here.
It may or may not been done aided by Kagi's Assist
Steps
- Add table name to output (set)
- Convert data to binary (convertToFile)
- Save file locally (readWriteFile)
- Extract data from file (extractFromFile)
- Chat Trigger (noOp)
- Sticky Note (stickyNote)
- When clicking "Test workflow" (manualTrigger)
- Combine schema data and chat input (set)
- Load the schema from the local file (readWriteFile)
- Extract SQL query (set)
- Check if query exists (if)
- Format query results (set)
- Combine query result and chat answer (merge)
- List all columns in a table (postgres)
- List all tables in a database (postgres)
- Ollama Chat Model (noOp)
- Postgres (postgres)
- Add trailing semicolon (set)
- Check for trailing semicolon (if)
- WorkflowTrigger (executeWorkflowTrigger)
- If ran manually (if)
- If file exists or already retried generating it (if)
- Sticky Note1 (stickyNote)
- AI Agent (noOp)
- Format empty output (set)
- Sticky Note2 (stickyNote)
- Error Handler (stopAndError)
Import
Download the JSON from the GitHub source and import it in n8n (Workflows, Import from file).
Author: Zie619, n8n workflow collection. License: MIT.
Shown here with formatting for the web. Keep the author and license notice when you reuse it.
Related entries
There are more like this in the members library
The n8n workflow library holds 1,814 entries. Members can search all of them by meaning and read every one in full.