{
  "openruna_format": "flow-graph-v1",
  "title": "Generate SQL queries from schema only - AI-powered",
  "slug": "generate-sql-queries-from-schema-only-ai-powered",
  "source_filename": "1472_Extractfromfile_Converttofile_Create_Triggered.json",
  "nodes": [
    {
      "id": "OpenAI Chat Model",
      "name": "OpenAI Chat Model",
      "integration": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "kind": "action"
    },
    {
      "id": "Window Buffer Memory",
      "name": "Window Buffer Memory",
      "integration": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "kind": "action"
    },
    {
      "id": "No Operation, do nothing",
      "name": "No Operation, do nothing",
      "integration": "noOp",
      "kind": "logic"
    },
    {
      "id": "List all tables in a database",
      "name": "List all tables in a database",
      "integration": "mySql",
      "kind": "action"
    },
    {
      "id": "Extract database schema",
      "name": "Extract database schema",
      "integration": "mySql",
      "kind": "action"
    },
    {
      "id": "Add table name to output",
      "name": "Add table name to output",
      "integration": "set",
      "kind": "logic"
    },
    {
      "id": "Convert data to binary",
      "name": "Convert data to binary",
      "integration": "convertToFile",
      "kind": "action"
    },
    {
      "id": "Save file locally",
      "name": "Save file locally",
      "integration": "readWriteFile",
      "kind": "action"
    },
    {
      "id": "Extract data from file",
      "name": "Extract data from file",
      "integration": "extractFromFile",
      "kind": "action"
    },
    {
      "id": "Chat Trigger",
      "name": "Chat Trigger",
      "integration": "@n8n/n8n-nodes-langchain.chat",
      "kind": "trigger"
    },
    {
      "id": "AI Agent",
      "name": "AI Agent",
      "integration": "@n8n/n8n-nodes-langchain.agent",
      "kind": "action"
    },
    {
      "id": "When clicking \"Test workflow\"",
      "name": "When clicking \"Test workflow\"",
      "integration": "manual",
      "kind": "trigger"
    },
    {
      "id": "Combine schema data and chat input",
      "name": "Combine schema data and chat input",
      "integration": "set",
      "kind": "logic"
    },
    {
      "id": "Load the schema from the local file",
      "name": "Load the schema from the local file",
      "integration": "readWriteFile",
      "kind": "action"
    },
    {
      "id": "Extract SQL query",
      "name": "Extract SQL query",
      "integration": "set",
      "kind": "logic"
    },
    {
      "id": "Check if query exists",
      "name": "Check if query exists",
      "integration": "if",
      "kind": "logic"
    },
    {
      "id": "Format query results",
      "name": "Format query results",
      "integration": "set",
      "kind": "logic"
    },
    {
      "id": "Run SQL query",
      "name": "Run SQL query",
      "integration": "mySql",
      "kind": "action"
    },
    {
      "id": "Prepare final output",
      "name": "Prepare final output",
      "integration": "set",
      "kind": "logic"
    },
    {
      "id": "Combine query result and chat answer",
      "name": "Combine query result and chat answer",
      "integration": "merge",
      "kind": "logic"
    }
  ],
  "edges": [
    {
      "from": "AI Agent",
      "to": "Extract SQL query"
    },
    {
      "from": "Chat Trigger",
      "to": "Load the schema from the local file"
    },
    {
      "from": "Run SQL query",
      "to": "Format query results"
    },
    {
      "from": "Extract SQL query",
      "to": "Check if query exists"
    },
    {
      "from": "Format query results",
      "to": "Combine query result and chat answer"
    },
    {
      "from": "Check if query exists",
      "to": "Run SQL query"
    },
    {
      "from": "Check if query exists",
      "to": "Combine query result and chat answer"
    },
    {
      "from": "Check if query exists",
      "to": "No Operation, do nothing"
    },
    {
      "from": "Convert data to binary",
      "to": "Save file locally"
    },
    {
      "from": "Extract data from file",
      "to": "Combine schema data and chat input"
    },
    {
      "from": "Extract database schema",
      "to": "Add table name to output"
    },
    {
      "from": "Add table name to output",
      "to": "Convert data to binary"
    },
    {
      "from": "List all tables in a database",
      "to": "Extract database schema"
    },
    {
      "from": "When clicking \"Test workflow\"",
      "to": "List all tables in a database"
    },
    {
      "from": "Combine schema data and chat input",
      "to": "AI Agent"
    },
    {
      "from": "Load the schema from the local file",
      "to": "Extract data from file"
    },
    {
      "from": "Combine query result and chat answer",
      "to": "Prepare final output"
    }
  ]
}