{
  "name": "Query Databricks data and SQL insights via Slack with Gemini AI agent",
  "nodes": [
    {
      "id": "da09cc5d-4b12-4a17-8916-ed24446e041f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2400,
        -48
      ],
      "parameters": {
        "width": 480,
        "height": 656,
        "content": "## Chat with databricks\n\n### How it works\n\n1. A Slack trigger initiates the workflow upon receiving a message. 2. The workflow fetches the Databricks table schema and parses it for the AI model. 3. An"
      }
    },
    {
      "id": "4df1fe14-99b9-4c68-bf3d-c13f827decf2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2944,
        128
      ],
      "parameters": {
        "width": 608,
        "height": 272,
        "content": "## Initialize trigger and connection\n\nTriggering the process and preparing Databricks connection details."
      }
    },
    {
      "id": "4f0836ac-a5b8-4749-97d4-4c50c163d66f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3584,
        80
      ],
      "parameters": {
        "width": 656,
        "height": 544,
        "content": "## Process schema and AI agent\n\nParsing table schema and processing AI logic using Gemini and tools to execute generated sql query."
      }
    },
    {
      "id": "334d777e-dfa3-4df4-9d2a-eca0f2a3a7cc",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4272,
        -48
      ],
      "parameters": {
        "width": 448,
        "height": 560,
        "content": "## Evaluate conditions and report\n\nHandling conditional responses and final Slack notifications."
      }
    },
    {
      "id": "a9f9654f-f76a-4646-b2eb-28adbe041d3b",
      "name": "When Slack Message Received",
      "type": "n8n-nodes-base.slackTrigger",
      "position": [
        2992,
        240
      ]
    },
    {
      "id": "80f0882d-dd25-4e3b-b5c4-2b605359f3ff",
      "name": "Parse Table Schema",
      "type": "n8n-nodes-base.code",
      "position": [
        3648,
        240
      ]
    },
    {
      "id": "69c720ed-86e4-4edf-bbf8-79c01fb40c90",
      "name": "Post to Slack Channel",
      "type": "n8n-nodes-base.slack",
      "position": [
        4560,
        80
      ]
    },
    {
      "id": "7d5794c0-19a4-4f31-b9bd-a86fb7eb4b4b",
      "name": "Fetch Databricks Schema",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3408,
        240
      ]
    },
    {
      "id": "0faf472b-c048-4879-b0b1-147a81392aba",
      "name": "Set Databricks Config",
      "type": "n8n-nodes-base.set",
      "position": [
        3200,
        240
      ]
    },
    {
      "id": "29de86cd-0e50-4976-93a6-c3812a911dfc",
      "name": "SQL Data Analyst Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        3872,
        240
      ]
    },
    {
      "id": "a91bbc88-0063-4a23-ba0f-2770e61070c1",
      "name": "Gemini Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        3744,
        448
      ]
    },
    {
      "id": "8b21f5c3-0ec3-4cf6-9b36-362ce2c162ac",
      "name": "Redis Chat Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "position": [
        3936,
        448
      ]
    },
    {
      "id": "c6e06aa2-79fe-472c-8ceb-353843e12ee2",
      "name": "Run Primary SQL Query",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        4112,
        448
      ]
    },
    {
      "id": "490fac20-41ef-465f-81ec-b0efed3ffcab",
      "name": "If Output Valid",
      "type": "n8n-nodes-base.if",
      "position": [
        4320,
        240
      ]
    },
    {
      "id": "24e93021-0a48-4f42-a61f-c176cfdd7571",
      "name": "Post Error to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        4576,
        336
      ]
    }
  ],
  "connections": {
    "Gemini Model": {
      "ai_languageModel": [
        [
          {
            "node": "SQL Data Analyst Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "If Output Valid": {
      "main": [
        [
          {
            "node": "Post to Slack Channel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Post Error to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redis Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "SQL Data Analyst Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Parse Table Schema": {
      "main": [
        [
          {
            "node": "SQL Data Analyst Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Primary SQL Query": {
      "ai_tool": [
        [
          {
            "node": "SQL Data Analyst Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Set Databricks Config": {
      "main": [
        [
          {
            "node": "Fetch Databricks Schema",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SQL Data Analyst Agent": {
      "main": [
        [
          {
            "node": "If Output Valid",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Databricks Schema": {
      "main": [
        [
          {
            "node": "Parse Table Schema",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Slack Message Received": {
      "main": [
        [
          {
            "node": "Set Databricks Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}