SNQL to SQL Parser A simple and extensible SNQL (Simple Natural Query Language) to SQL parser built using Python. This project allows users to write human-readable queries in SNQL and convert them into standard SQL queries.
π Features Convert SNQL queries to SQL queries
Supports basic SQL operations: SELECT, WHERE, ORDER BY, LIMIT, etc.
Modular and easy to extend
Written in clean and readable Python code
π οΈ Technologies Used Python 3.x
re module for regex-based parsing
CLI support (optional)
Optional: Flask (for API version)
π¦ Installation Clone the repository:
bash Copy Edit git clone https://github.com/yourusername/snql-to-sql-parser.git cd snql-to-sql-parser (Optional) Create and activate a virtual environment:
bash
Copy
Edit
python -m venv venv
source venv/bin/activate # On Windows use venv\Scripts\activate
Install dependencies (if any):
bash Copy Edit pip install -r requirements.txt π§ SNQL Syntax Examples SNQL SQL get name, age from users SELECT name, age FROM users; get * from orders where price > 100 SELECT * FROM orders WHERE price > 100; get id from logs order by date desc limit 5 SELECT id FROM logs ORDER BY date DESC LIMIT 5; π§ Usage As a Python script python Copy Edit from snql_parser import parse_snql
snql_query = "get name, age from users where age > 25" sql_query = parse_snql(snql_query) print(sql_query) Output: pgsql Copy Edit SELECT name, age FROM users WHERE age > 25; π§ͺ Running Tests bash Copy Edit python -m unittest discover tests π Project Structure pgsql Copy Edit snql-to-sql-parser/ β βββ snql_parser.py # Core logic for SNQL to SQL conversion βββ app.py # (Optional) Flask API interface βββ tests/ β βββ test_snql_parser.py βββ requirements.txt βββ README.md π§ Future Improvements Add support for JOIN operations
Natural language enhancements (e.g., βshow meβ, βlist allβ)
GUI or web-based interface
Voice command to SNQL integration
π Contributing Contributions, issues, and feature requests are welcome! Feel free to open a pull request or issue.