A LLM based agentic framework for querying SQL databases with natural Language
Find a file
Matt-Olek 9c017b3e9f Init
2025-05-09 19:03:14 +02:00
ressources Init 2025-05-09 19:03:14 +02:00
src Init 2025-05-09 19:03:14 +02:00
.env.example Init 2025-05-09 19:03:14 +02:00
.gitignore Initial commit 2025-05-09 13:03:43 +02:00
docker-compose.yml Init 2025-05-09 19:03:14 +02:00
README.md Init 2025-05-09 19:03:14 +02:00
requirements.txt Init 2025-05-09 19:03:14 +02:00

SQLCrawler

A natural language to SQL agent built with LangGraph that enables querying databases with plain English. SQLCrawler automatically performs database discovery, executes queries, and handles follow-up questions.

SQLCrawler Demo

Prerequisites

  • Python 3.8+
  • OpenAI API key (for GPT-4o-mini model access)
  • PostgreSQL database instance (or use the provided Docker setup)

Installation

  1. Clone the repository
git clone https://github.com/yourusername/SQLCrawler.git
cd SQLCrawler
  1. Install dependencies
pip install -r requirements.txt

Quick Start

Option 1: Use your existing PostgreSQL database

If you already have a PostgreSQL database running, you can directly launch SQLCrawler:

python src/run.py

Option 2: Use the provided Docker demo environment

  1. Start the Docker containers (PostgreSQL + PgAdmin):
docker compose up --build
  1. Populate the database with sample data:
python src/populate_db.py
  1. Launch SQLCrawler:
python src/run.py

Note

: The default PostgreSQL credentials for the Docker setup are:

  • Host: localhost
  • Port: 5432
  • User: postgres
  • Password: postgres
  • Database: postgres

PgAdmin is available at http://localhost:5050 with credentials:

Usage

Once running, interact with SQLCrawler using natural language:

User: What tables are in the database?
User: How many users do we have?
User: Show me the top 5 products by price.

Type exit, quit, or q to end the session.