Enterprise Big Data Copilot
Enterprise Big Data Copilot
Ein KI-Copilot, der natürlichsprachliche Fragen in validiertes, schemabewusstes Trino-SQL übersetzt – mit RAG, MCP-Tools und lokaler LLM-Inferenz.
Überblick
Mit dem Enterprise Big Data Copilot können Nutzer Big-Data-Plattformen in einfachem Englisch abfragen. Eine LangGraph-Pipeline ruft relevante Dokumentationen (RAG) und Live-Schema-Metadaten (MCP) ab, generiert mit einem lokalen LLM (Ollama) SQL, validiert es anhand von Sicherheits- und Schemaregeln und führt es – sofern die Plattform erreichbar ist – auf Trino aus und liefert echte Zeilen zurück.
Related MCP server: Doris MCP Server
Funktionen
Text-zu-SQL-Generierung in natürlicher Sprache für Trino
Lokale LLM-Inferenz mit Ollama (keine Cloud-API erforderlich)
RAG-Abruf über Trino-/Hive-/Iceberg-Dokumentation (Qdrant)
Schemabewusste Generierung auf Basis von Live-Katalogmetadaten
SQL-Validierung (Erzwingung von schreibgeschützten SELECT-Abfragen, Parse-Prüfung, Schema-Anbindung) mit automatischer Regenerationsschleife
Best-Effort-Abfrageausführung und Ergebnisabruf von Trino
MCP-Server (Model Context Protocol), der Metadaten-, Abfrage- und Profiling-Tools bereitstellt
OpenAI-kompatible API für Open WebUI
End-to-End-Pipeline-Tracing mit LangSmith
Architektur
flowchart LR
User --> API
API --> Agent
Agent --> RAG
RAG --> Qdrant
Agent --> LLM
Agent --> MCP
MCP --> Trino
Agent --> Validation
Agent --> Response
Response --> UserTechnologiestack
Technologie | Zweck |
Python + FastAPI | Backend und REST/OpenAI-kompatible API |
LangGraph | Pipeline-Orchestrierung (RAG → Schema → SQL → validieren → ausführen) |
Ollama | Lokales LLM ( |
LangChain + Qdrant | RAG-Dokumentabruf |
FastMCP | Model-Context-Protocol-Server (Tools) |
LangSmith | Pipeline-Tracing und -Überwachung |
Trino | SQL-Abfrage-Engine (TPCH-Demokatalog) |
Open WebUI | Chat-Oberfläche (optional) |
Docker | Containerisierte Infrastruktur |
Projektstruktur
app/
├── agent/ # SQL agent + prompts (Ollama)
├── api/ # REST + OpenAI-compatible endpoints
├── core/ # Config, models, exceptions, logging
├── formatter/ # Response formatting
├── mcp/ # MCP server, client, catalog services
├── orchestrator/ # LangGraph pipeline
├── rag/ # Ingestion and retrieval (Qdrant)
├── services/ # Trino client
└── validator/ # SQL validation
tests/ # pytest suite
docker/ # App image + Trino config
docs/ # RAG knowledge base
scripts/ # Document ingestion CLIErste Schritte
Voraussetzungen
Python 3.11 oder 3.12 (3.13 wird nicht unterstützt)
Docker + Docker Compose
GPU optional (Ollama läuft auch auf der CPU)
Installation
git clone https://github.com/hani-ben-dhaou/Enterprise-Big-Data-Copilot.git
cd entreprise-bigdata-copilot
python -m venv .venv
# Windows: .venv\Scripts\activate | macOS/Linux: source .venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt # pytestKonfiguration
cp .env.example .envWichtige Variablen (Standardwerte funktionieren für die lokale Entwicklung):
Variable | Beschreibung |
| LLM-Server und -Modell ( |
| Embedding-Modell ( |
| Qdrant-Vektordatenbank |
| Trino (Standardkatalog |
|
|
|
|
| Führt validiertes SQL auf Trino aus |
| Auf |
| Ihr LangSmith-API-Schlüssel (Tracing bleibt ohne Angabe deaktiviert) |
| LangSmith-Projektname (Standard: |
Ausführen
# 1. Start infrastructure (Ollama, Qdrant, Trino)
docker compose up -d
# 2. Pull models and ingest documentation (Qdrant must be up)
docker exec -it copilot-ollama ollama pull llama3.2
docker exec -it copilot-ollama ollama pull mxbai-embed-large
python scripts/ingest_docs.py
# 3. Start the API
uvicorn app.main:app --reload --port 8000
# 4. Optional: standalone MCP server (SSE on :8001)
python -m app.mcp.serverVerwendung
Stellen Sie eine Frage in natürlicher Sprache:
curl -X POST http://localhost:8000/api/v1/query \
-H "Content-Type: application/json" \
-d '{"question":"Show me the top 10 customers by total revenue last month"}'Die Antwort enthält das generierte SQL, eine Erklärung, einen Konfidenzwert, Warnungen und – sofern die Ausführung aktiviert ist – die Ergebniszeilen:
{
"question": "Show me the top 10 customers by total revenue last month",
"sql": "SELECT ...",
"explanation": "...",
"confidence": 0.92,
"warnings": [],
"dialect": "trino",
"results": [["42", "Acme", 98765.00]],
"execution": {"status": "ok", "columns": ["id", "name", "revenue"], "row_count": 1, "truncated": false}
}Weitere Endpunkte: GET /api/v1/schema (Katalog auflisten), GET /api/v1/health und POST /v1/chat/completions (OpenAI-kompatibel, wird von Open WebUI verwendet).
Tests
pytestDie Testsuite ist hermetisch und läuft ohne Live-Stack (146 Tests).
Tracing & Monitoring
Jede Pipeline-Abfrage (RAG-Abruf, Schemaabfrage, SQL-Generierung, Validierungsschleifen, Ausführung) kann mit LangSmith nachverfolgt werden. Erstellen Sie ein kostenloses Konto, holen Sie sich einen API-Schlüssel und setzen Sie: LANGCHAIN_TRACING_V2=true, LANGCHAIN_API_KEY=<Ihr Schlüssel> und optional LANGCHAIN_PROJECT=copilot. Solange kein Schlüssel konfiguriert ist, bleibt das Tracing deaktiviert.

Docker
docker compose startet den gesamten Stack:
Dienst | Container | Port |
Ollama |
| 11434 |
Qdrant |
| 6333 |
Trino |
| 8080 |
Open WebUI |
| 3000 |
Copilot API |
| 8000 |
MCP-Server |
| 8001 |
Benannte Volumes speichern Ollama-Modelle, Qdrant-Daten und Open-WebUI-Daten. Das ollama-Volume ist als external deklariert – falls nicht vorhanden, einmalig erstellen:
docker volume create ollama
docker compose up -d
docker compose ps
docker compose logs -f copilot-api
docker compose downHinweis für Windows: MCP über echtes SSE kann in der Windows-Ereignisschleife unzuverlässig sein. Verwenden Sie für die lokale Entwicklung unter Windows
MCP_TRANSPORT=inprocess; nutzen Sie SSE unter Linux/Docker.
This server cannot be deployed
Maintenance
Related MCP Connectors
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides AI models with structured access to Trino's distributed SQL query engine, enabling LLMs to directly query and analyze data stored in Trino databases.310MIT
- AlicenseNot gradedqualityFmaintenanceEnables natural language querying of Apache Doris databases via LLM-powered SQL generation, execution, and metadata management through the MCP protocol.9Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables listing and querying Trino tables via MCP, supporting arbitrary SQL queries against a Trino cluster.MIT
- FlicenseAqualityAmaintenanceNatural language to SQL engine with multi-connector support (PostgreSQL, MySQL, Snowflake, BigQuery, DuckDB), document QA, semantic caching, and self-hosted MCP server.931 PyPI4-