{
  "name": "Convert CSV/XLSX files into a normalized SQL schema with GPT-4",
  "nodes": [
    {
      "id": "45ed7648-24d5-4f61-a1fb-190aded55d7e",
      "name": "Upload Files Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -912,
        -64
      ]
    },
    {
      "id": "48ede746-2041-47b6-9644-d7c1ef211f4e",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -608,
        -64
      ]
    },
    {
      "id": "9566ffef-ce10-456f-b1a4-74dfab6848b3",
      "name": "Check File Type",
      "type": "n8n-nodes-base.if",
      "position": [
        -336,
        -64
      ]
    },
    {
      "id": "a8f93e71-bc03-447b-8a9d-6350c56bb872",
      "name": "Extract CSV Data",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -128,
        -160
      ]
    },
    {
      "id": "9f96e5af-5be6-465c-981b-09a2dd126449",
      "name": "Extract Excel Data",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -128,
        32
      ]
    },
    {
      "id": "ac1cc4e4-09cc-4386-984c-42f99581713b",
      "name": "Column Profiling Engine",
      "type": "n8n-nodes-base.code",
      "position": [
        144,
        -64
      ]
    },
    {
      "id": "5d76c141-176e-49e3-8f6b-a06854506a19",
      "name": "Aggregate All Datasets",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        336,
        -64
      ]
    },
    {
      "id": "2730cfc0-2e65-41a5-b77f-31a03dbfd246",
      "name": "Schema Reasoning Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        544,
        -112
      ]
    },
    {
      "id": "ad9c1862-c897-4dcc-ae4e-ec820da8f522",
      "name": "Schema JSON Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        736,
        32
      ]
    },
    {
      "id": "bc033391-3d9c-4cc3-ab97-ad0276efe75d",
      "name": "Rule Validator",
      "type": "n8n-nodes-base.code",
      "position": [
        912,
        -64
      ]
    },
    {
      "id": "a14dcff2-c7f6-4397-8c5b-d0fd66ff0d47",
      "name": "SQL Schema Generator",
      "type": "n8n-nodes-base.code",
      "position": [
        1168,
        -64
      ]
    },
    {
      "id": "055c9b60-af59-4ece-ac00-e3a0550d9160",
      "name": "Generate Data Dictionary & ERD",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        -64
      ]
    },
    {
      "id": "012da755-1b1a-46d5-a23c-cd18daceb1dd",
      "name": "Return Results",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1744,
        -64
      ]
    },
    {
      "id": "3abc6b02-2765-4336-8d93-fe2b223611e5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -208
      ],
      "parameters": {
        "width": 502,
        "height": 288,
        "content": "## Input & Configuration\n\nHandles file upload via webhook and initializes schema generation settings such as thresholds and normalization rules."
      }
    },
    {
      "id": "e428ba61-4982-4a27-b547-7ef8028c99f1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        -288
      ],
      "parameters": {
        "width": 230,
        "height": 432,
        "content": "## Schema Validation\n\nValidates the generated schema by checking keys, relationships, data types, and normalization issues."
      }
    },
    {
      "id": "04d213e4-2d19-45e2-ac2a-5a51ae9c024c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1664,
        -288
      ],
      "parameters": {
        "width": 246,
        "height": 416,
        "content": "## Final Output\n\nReturns the generated SQL schema, ERD, and data dictionary as a structured JSON response via webhook."
      }
    },
    {
      "id": "fa24b327-27b6-487d-8f25-7dcd2a6366be",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -288
      ],
      "parameters": {
        "width": 358,
        "height": 432,
        "content": "## AI Schema Reasoning\n\nUses an AI agent to design a normalized relational schema with tables, relationships, and constraints based on data analysis."
      }
    },
    {
      "id": "8402104c-39f2-450b-8f6e-730f4b6b81af",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        -288
      ],
      "parameters": {
        "width": 470,
        "height": 480,
        "content": "## File Detection & Extraction\n\nDetects file type (CSV or Excel) and converts the uploaded file into structured JSON data for processing."
      }
    },
    {
      "id": "680bff54-3b01-4a60-a865-b7fa45c7bc2c",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -288
      ],
      "parameters": {
        "width": 374,
        "height": 432,
        "content": "## Column Profiling Engine and Dataset Aggregation\n\nAnalyzes dataset columns to detect data types, patterns, uniqueness, entropy, and potential keys or relationships and Combines all processed dataset"
      }
    },
    {
      "id": "2e63a4c3-983e-4400-9b6c-9f1473a7775a",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        -304
      ],
      "parameters": {
        "width": 368,
        "height": 464,
        "content": "## AI Multi-Table Schema Builder with Automated Normalization and Relationship Detection\n\n## How it works\nThis workflow converts CSV/XLSX files into a fully validated database schema. It extracts and "
      }
    },
    {
      "id": "27796da6-c284-4dbd-ae5f-afe8198dfd91",
      "name": "OpenAI GPT",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        512,
        32
      ]
    },
    {
      "id": "1ed03458-6bee-4d0c-8c3c-c28dcd0ca04e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        -288
      ],
      "parameters": {
        "width": 230,
        "height": 432,
        "content": "## SQL Schema Generation\n\nGenerates executable SQL scripts including table creation, constraints, and indexes."
      }
    },
    {
      "id": "af162567-336c-4616-9846-97bbef682013",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1376,
        -288
      ],
      "parameters": {
        "width": 230,
        "height": 432,
        "content": "## ERD & Data Dictionary\n\nCreates a visual ERD and a detailed data dictionary describing tables, columns, and relationships."
      }
    }
  ],
  "connections": {
    "OpenAI GPT": {
      "ai_languageModel": [
        [
          {
            "node": "Schema Reasoning Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Rule Validator": {
      "main": [
        [
          {
            "node": "SQL Schema Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check File Type": {
      "main": [
        [
          {
            "node": "Extract CSV Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract Excel Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract CSV Data": {
      "main": [
        [
          {
            "node": "Column Profiling Engine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Excel Data": {
      "main": [
        [
          {
            "node": "Column Profiling Engine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schema JSON Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Schema Reasoning Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "SQL Schema Generator": {
      "main": [
        [
          {
            "node": "Generate Data Dictionary & ERD",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Files Webhook": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate All Datasets": {
      "main": [
        [
          {
            "node": "Schema Reasoning Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schema Reasoning Agent": {
      "main": [
        [
          {
            "node": "Rule Validator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Check File Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Column Profiling Engine": {
      "main": [
        [
          {
            "node": "Aggregate All Datasets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Data Dictionary & ERD": {
      "main": [
        [
          {
            "node": "Return Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}