A lightweight Python CLI app that mimics basic SQL-style querying from in-memory databases like People
and Aliens
. No setup, no SQL server — just Python logic and structured data.
This was built as a personal learning tool to:
- Simulate SQL logic using Python
- Practice user input parsing and command interpretation
- Understand how a query engine processes and accesses data
- Improve backend skills for future projects
It’s a beginner-friendly foundation for future exploration into databases, interpreters, and even building a custom query language.
- Defines two example databases in memory:
People
andAliens
- Accepts user input with SQL-like commands:
SELECT
FROM
LIMIT
- Ends with
DONE
- Parses the command and fetches relevant results
- Displays the filtered data to the user
SELECT name
FROM aliens
LIMIT 2
DONE
Zorglon
Bleep
Command | Description |
---|---|
SELECT |
What field to display (name , age , * ) |
FROM |
Which dataset to use (people , aliens ) |
LIMIT |
How many results to show |
DONE |
Ends input and runs the query |
Commands must be entered one per line and end with DONE
.
WHERE
support (e.g.,WHERE age > 30
)- Allow selecting multiple fields:
SELECT name, age
- Add sorting (
ORDER BY age DESC
) - Create a REPL-style session
- Load/save datasets from JSON or CSV
- Add error recovery for missing clauses or bad input
- Parsing strings and user input
- Control flow and conditionals
- Working with lists and dictionaries
- Simulating backend behavior
- CLI program structure and modularity
No libraries are required. Just Python 3.
python simple_query_runner.py
simpleSQLTool/
│
├── SimpleSQLtoolver3.py # Main program file
├── README.md # You're reading it!
If you expand this project to include file input/output or JSON parsing, you might add:
# optional future additions
pandas
json
click # for CLI improvement
Got suggestions? Want to build on top of this? Feel free to fork, clone, and remix this tool.
Reach out or open a pull request with your ideas 💡