Skip to content

Commit ac12c4d

Browse files
committed
add readme
1 parent 8288105 commit ac12c4d

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# NL2SQL Platform
2+
3+
An enterprise-grade **Natural Language to SQL** engine built on an Agentic Graph Architecture.
4+
5+
## 🚀 Overview
6+
7+
This platform transforms complex natural language questions into safe, optimized, and executable SQL queries across multiple database engines (PostgreSQL, MySQL, MSSQL, SQLite). It uses a **Directed Cyclic Graph** (LangGraph) to orchestrate planning, validation, generation, and self-correction.
8+
9+
### Key Features
10+
11+
* **🛡️ Security First**: Strict AST Validation, RBAC Policies, and Read-Only enforcement.
12+
* **🧠 Agentic Reasoning**: Self-correcting nodes that fix SQL errors automatically.
13+
* **🔌 Polyglot**: First-class support for Postgres, MySQL, MSSQL, and SQLite.
14+
* **⚡ Smart Routing**: Decomposes complex queries into sub-queries for multi-datasource environments.
15+
16+
## 🏁 Quick Demo
17+
18+
Explore the platform's capabilities with our interactive setup wizard. You can choose between **Lite Mode** (in-memory, no deps) or **Docker Mode** (real databases).
19+
20+
### 1. Lite Mode (Fastest) uses SQLite
21+
22+
Perfect for a standardized, local environment without needing Docker.
23+
24+
```bash
25+
nl2sql setup --demo
26+
```
27+
28+
### 2. Docker Mode (Full Fidelity) uses Postgres
29+
30+
Spins up real orchestrator and database containers for a production-like test.
31+
32+
```bash
33+
nl2sql setup --demo --docker
34+
```
35+
36+
## 🛠️ Installation
37+
38+
This is a monorepo. To develop or run the platform from source:
39+
40+
### Prerequisites
41+
42+
* Python 3.10+
43+
* Docker & Docker Compose (optional, for Integration Tests)
44+
45+
### Setup
46+
47+
1. **Clone and Install**:
48+
49+
```bash
50+
git clone https://github.com/nadeem4/nl2sql.git
51+
cd nl2sql
52+
53+
# Create virtual environment
54+
python -m venv venv
55+
source venv/bin/activate # or .\venv\Scripts\activate on Windows
56+
57+
# Install Core and CLI
58+
pip install -e packages/core
59+
pip install -e packages/adapter-sdk
60+
pip install -e packages/cli
61+
pip install -e packages/adapters/postgres # Install specific adapters as needed
62+
```
63+
64+
2. **Verify Installation**:
65+
66+
```bash
67+
nl2sql --help
68+
```
69+
70+
## 🏗️ Architecture
71+
72+
The system is composed of specialized Neural Nodes:
73+
74+
1. **Semantic Analysis**: Intent classification and entity extraction.
75+
2. **Decomposer (Router)**: Splits complex queries and routes them to the correct datasource.
76+
3. **Planner**: Generates a database-agnostic Abstract Syntax Tree (AST).
77+
4. **Validator**: Enforces security policies and logical correctness on the AST.
78+
5. **Generator**: Compiles AST to dialect-specific SQL.
79+
6. **Executor**: Runs the query in a sandboxed environment.
80+
7. **Refiner**: Self-corrects errors by analyzing stack traces and feedback.
81+
8. **Aggregator**: Synthesizes results from multiple sub-queries.
82+
83+
See [Architecture Documentation](docs/core/architecture.md) for details.
84+
85+
## 📚 Documentation
86+
87+
Full documentation is available in the `docs/` directory.
88+
89+
```bash
90+
pip install -r requirements-docs.txt
91+
mkdocs serve
92+
```
93+
94+
## 📂 Repository Structure
95+
96+
* `packages/core`: The core graph engine, nodes, and state management.
97+
* `packages/cli`: Command-line interface tool.
98+
* `packages/adapter-sdk`: SDK for building custom database adapters.
99+
* `configs/`: Configuration files (Policies, Datasources).
100+
* `docs/`: MkDocs source files.

0 commit comments

Comments
 (0)