Skip to content

Jnaneswari19/sql-mini-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Mini Engine

Python Tests License

A lightweight SQL engine built in Python that parses and executes simple SQL queries (SELECT, COUNT, WHERE) against CSV and CCOL (custom columnar format) data.


✨ Features

  • SQL Parser (Step 2)
  • Query Execution Engine (Step 3)
  • Interactive CLI (Step 4)
  • Unit Tests (Step 5)
  • Benchmarks (Step 6)
  • CCOL Writer/Reader (Step 7)
  • Selective Reads (Step 8)
  • String Offsets Optimization (Step 9)

🔧 Installation

Clone the repository and install dependencies:

git clone https://github.com/Jnaneswari19/sql-mini-engine.git
cd sql-mini-engine
pip install -r requirements.txt

🚀 Usage

Run queries via CLI:

python -m sqlmini.cli "SELECT name, age FROM people WHERE age >= 30;"

Run tests:

python -m pytest

📝 Example Queries

python -m sqlmini.cli "SELECT COUNT(*) FROM sales;"
python -m sqlmini.cli "SELECT name FROM people WHERE age < 25;"
python -m sqlmini.cli "SELECT COUNT(age) FROM people WHERE age >= 30;"

📊 Benchmarks

CSV vs CCOL

Query CSV (s) CCOL (s)
SELECT * FROM people; 0.000133 0.000735

Selective Reads

Format Time (s)
CSV selective read 0.000147
CCOL selective read 0.000821

Naive vs Offset CCOL

Format Read Time (s) File Size (bytes)
Naive CCOL 0.001012 186
Offset CCOL 0.002051 248

📂 Project Tree Structure

sql-mini-engine/
│   README.md
│   requirements.txt
│   LICENSE
│   .gitignore
│
├── data/
│   people.csv
│   people.ccol
│   people_naive.ccol
│   people_offsets.ccol
│   sales.csv
│
├── screenshots/
│   benchmarks.png
│   cli.png
│   tests.png
│   structure.png
│
├── sqlmini/
│   cli.py
│   engine.py
│   errors.py
│   parser.py
│   reader.py
│   writer.py
│   __init__.py
│
└── tests/
    test_parser.py
    test_engine.py
    test_performance.py
    test_ccol_bench.py
    test_selective_read_bench.py
    test_offsets_bench.py

📸 Proof Screenshots

✅ CLI Query Run

CLI Screenshot

✅ Pytest All Tests Passed

Pytest Screenshot

✅ Benchmark Outputs

Benchmark Screenshot

✅ Project Tree Structure

Tree Screenshot


✅ Final Checklist

  • Parser implemented
  • Engine implemented
  • CLI implemented
  • Tests passing
  • Benchmarks documented
  • CCOL Writer/Reader implemented
  • Selective reads working
  • String offsets optimization verified
  • README polished with proof screenshots
  • Installation section added
  • Extra query examples added
  • LICENSE file included
  • Root .gitignore included

📄 License

This project is licensed under the MIT License — see the LICENSE file for details.


About

A lightweight, in‑memory SQL query engine built in Python. Load CSV files and run basic SQL queries (SELECT, WHERE, COUNT) through a simple command‑line interface.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages