Skip to main content

Query Databricks data and SQL insights via Slack with Gemini AI agent

Workflow preview

Workflow preview
100%
Query Databricks data and SQL insights via Slack with Gemini AI agent preview
Open on n8n.io

1. Workflow Overview

Automated Databricks Data Querying & SQL Insights via Slack with AI Agent & Gemini Node by Node Explanation This workflow is divided into three functional phases: Initialization , AI Processing , a...

Best for

  • Document Extraction automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.slacktrigger, n8n-nodes-base.code, n8n-nodes-base.slack, n8n-nodes-base.httprequest, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatgooglegemini

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Query Databricks data and SQL insights via Slack with Gemini AI agent
Workflow name
Query Databricks data and SQL insights via Slack with Gemini AI agent

Automated Databricks Data Querying & SQL Insights via Slack with AI Agent & Gemini


Node-by-Node Explanation

This workflow is divided into three functional phases: Initialization, AI Processing, and Response Delivery.

Node Name Category What it does
When Slack Message Received Trigger Monitors a Slack channel for @mentions. It captures the user's question and the thread ID to keep the conversation organized.
Set Databricks Config Configuration A "helper" node where you hardcode your Databricks warehouse_id and target_table. This makes it easy to update settings in one place.
Fetch Databricks Schema Data Retrieval Sends a DESCRIBE command to the Databricks API. It learns what columns exist (e.g., "price", "date", "store_id") so the AI knows what it can query.
Parse Table Schema Data Transformation Uses JavaScript to clean up the raw Databricks response. it converts complex technical data into a simple list that the AI can easily read.
SQL Data Analyst Agent AI Brain The "manager" of the workflow. It takes the user's question and the table schema, decides which SQL query to write, and interprets the results.
Gemini Model LLM Engine Provides the actual intelligence (using Google Gemini 3.1 Flash). This is what "thinks" and generates the SQL and conversational text.
Redis Chat Memory Memory Stores previous messages in the thread. This allows you to ask follow-up questions (e.g., "Now show me only the top 5") without repeating the whole context.
Run Primary SQL Query AI Tool An HTTP tool given to the Agent. The Agent "calls" this node to actually run the generated SQL on Databricks and get the real data back.
If Output Valid Logic Gate A safety check. It verifies if the Agent successfully produced a message for Slack or if something went wrong during the process.
Post to Slack Channel Output (Success) Sends the final answer (e.g., "The total revenue for Q3 was $4.2M") back to the user in Slack.
Post Error to Slack Output (Failure) If the SQL fails or the AI hits a wall, this node sends an error message to the user so they aren't left waiting.

How the "Agent" Loop Works

Unlike a standard linear workflow, the SQL Data Analyst Agent doesn't just move to the next step. It performs a "Reasoning" loop:

  1. Observe: "The user wants to know sales for March."
  2. Think: "I have a table called 'franchises' with a 'sale_date' column. I should run a SUM query."
  3. Act: It triggers the Run Primary SQL Query node.
  4. Observe Results: "The query returned 150,000."
  5. Final Response: "The total sales for March were 150,000."

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 - Sticky Note

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

Block 2 - Sticky Note1

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

Block 3 - Sticky Note2

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

Block 4 - Sticky Note3

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

Block 5 - When Slack Message Received

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

Block 6 - Parse Table Schema

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

Block 7 - Post to Slack Channel

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

Block 8 - Fetch Databricks Schema

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

Block 9 - Set Databricks Config

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

Block 10 - SQL Data Analyst Agent

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

Block 11 - Gemini Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 12 - Redis Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryRedisChat - memoryRedisChat
Config choices
Version 1.5

Block 13 - Run Primary SQL Query

Type / Role
n8n-nodes-base.httpRequestTool - httpRequestTool
Config choices
Version 4.4

Block 14 - If Output Valid

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

Block 15 - Post Error to Slack

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

3. Summary Table

Workflow Query Databricks data and SQL insights via Slack with Gemini AI agent
Complexity advanced
Nodes 15
Categories Document Extraction, AI Chatbot
Author iamvaar
Published 23 Mar 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14254/14254.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 Databricks data and SQL insights via Slack with Gemini AI agent do?

Automated Databricks Data Querying & SQL Insights via Slack with AI Agent & Gemini Node by Node Explanation This workflow is divided into three functional phases: Initialization , AI Processing , a...

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 Document Extraction, AI Chatbot use case.