Query Databricks data and SQL insights via Slack with Gemini AI agent
Automated Databricks Data Querying & SQL Insights via Slack with AI Agent & Gemini ---
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:
- Observe: "The user wants to know sales for March."
- Think: "I have a table called 'franchises' with a 'sale_date' column. I should run a SUM query."
- Act: It triggers the Run Primary SQL Query node.
- Observe Results: "The query returned 150,000."
- Final Response: "The total sales for March were 150,000."
production deployment
Need this workflow deployed or tailored for your business?
I customize n8n pipelines, build proprietary API nodes, and connect production databases with sub-100ms reliability.
creator
iamvaar
Top 50 Verified Creator
AI Automation Engineer building production-grade n8n systems, custom nodes, and LLM pipelines.
n8n.io/creators/iamvaarspecs
related automations
More workflows from iamvaar
Automate rental agreements with BoldSign, Google Sheets & Gemini AI
Complete Video Documentation: https://youtu.be/O-bKlX3G74(https://youtu.be/O-bKlX3G74)
Transcribe and analyze sales meetings with Deepgram, Gemini, GHL, Slack & Gmail
Quick overview Youtube Video: https://youtu.be/GNAplBWdCDE?si=TjojVTZX7ViiRUiG
Score AQI health risks with Open-Meteo, AirNow, Gemini, WhatsApp, SMS and Slack
Quick overview Video Explanation: https://youtu.be/5TNw4aaHtHI?si=wLY3Gci9n3vKYNQ
Want this workflow running in your stack?
Book a free 30-minute session. I'll inspect your current infrastructure, review required API credentials, and map out the deployment.