{
  "openruna_format": "flow-graph-v1",
  "title": "Translate questions about e-mails into SQL queries and run them",
  "slug": "translate-questions-about-e-mails-into-sql-queries-and-run-them",
  "source_filename": "1245_Postgres_Extractfromfile_Automation_Triggered.json",
  "nodes": [
    {
      "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": "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": "Combine query result and chat answer",
      "name": "Combine query result and chat answer",
      "integration": "merge",
      "kind": "logic"
    },
    {
      "id": "List all columns in a table",
      "name": "List all columns in a table",
      "integration": "postgres",
      "kind": "action"
    },
    {
      "id": "List all tables in a database",
      "name": "List all tables in a database",
      "integration": "postgres",
      "kind": "action"
    },
    {
      "id": "Ollama Chat Model",
      "name": "Ollama Chat Model",
      "integration": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "kind": "action"
    },
    {
      "id": "Postgres",
      "name": "Postgres",
      "integration": "postgres",
      "kind": "action"
    },
    {
      "id": "Add trailing semicolon",
      "name": "Add trailing semicolon",
      "integration": "set",
      "kind": "logic"
    },
    {
      "id": "Check for trailing semicolon",
      "name": "Check for trailing semicolon",
      "integration": "if",
      "kind": "logic"
    },
    {
      "id": "WorkflowTrigger",
      "name": "WorkflowTrigger",
      "integration": "executeWorkflow",
      "kind": "trigger"
    },
    {
      "id": "If ran manually",
      "name": "If ran manually",
      "integration": "if",
      "kind": "logic"
    },
    {
      "id": "If file exists or already retried generating it",
      "name": "If file exists or already retried generating it",
      "integration": "if",
      "kind": "logic"
    },
    {
      "id": "AI Agent",
      "name": "AI Agent",
      "integration": "@n8n/n8n-nodes-langchain.agent",
      "kind": "action"
    },
    {
      "id": "Format empty output",
      "name": "Format empty output",
      "integration": "set",
      "kind": "logic"
    }
  ],
  "edges": [
    {
      "from": "AI Agent",
      "to": "Extract SQL query"
    },
    {
      "from": "Postgres",
      "to": "Format query results"
    },
    {
      "from": "Chat Trigger",
      "to": "Load the schema from the local file"
    },
    {
      "from": "If ran manually",
      "to": "Load the schema from the local file"
    },
    {
      "from": "WorkflowTrigger",
      "to": "Load the schema from the local file"
    },
    {
      "from": "Extract SQL query",
      "to": "Check for trailing semicolon"
    },
    {
      "from": "Save file locally",
      "to": "If ran manually"
    },
    {
      "from": "Format query results",
      "to": "Combine query result and chat answer"
    },
    {
      "from": "Check if query exists",
      "to": "Combine query result and chat answer"
    },
    {
      "from": "Check if query exists",
      "to": "Postgres"
    },
    {
      "from": "Check if query exists",
      "to": "Format empty output"
    },
    {
      "from": "Add trailing semicolon",
      "to": "Check if query exists"
    },
    {
      "from": "Convert data to binary",
      "to": "Save file locally"
    },
    {
      "from": "Extract data from file",
      "to": "Combine schema data and chat input"
    },
    {
      "from": "Add table name to output",
      "to": "Convert data to binary"
    },
    {
      "from": "List all columns in a table",
      "to": "Add table name to output"
    },
    {
      "from": "Check for trailing semicolon",
      "to": "Add trailing semicolon"
    },
    {
      "from": "Check for trailing semicolon",
      "to": "Check if query exists"
    },
    {
      "from": "List all tables in a database",
      "to": "List all columns in a table"
    },
    {
      "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": "If file exists or already retried generating it"
    },
    {
      "from": "If file exists or already retried generating it",
      "to": "Extract data from file"
    },
    {
      "from": "If file exists or already retried generating it",
      "to": "List all tables in a database"
    }
  ]
}