Simple SQL query parser and executor for Python. Only supports SELECT statements with WHERE, and LIMIT on a single table.
Make sure you have pyparsing installed.
Run main.py with the SQL query as a command line argument.
Here are some example queries:
SELECT state, pop FROM table WHERE region = 'East';
SELECT * FROM table;
SELET state, region FROM table WHERE pop > 30;
SELECT region, pop_male, pop_female FROM table WHERE pop < 50 AND state = 'Texas';
SELECT city FROM table WHERE state = 'Florida';
SELECT state, pop FROM table LIMIT 5;
SELECT state, region FROM table LIMIT 'five';
SELECT state, pop FROM table WHERE (pop_male > 20 AND region = 'West') OR pop_female < 15;
SELECT state, pop_male FROM table WHERE pop >;
SELECT * FROM table;
SELEC state FROM table;
SELECT non_existent_column FROM table;
SELECT state, FROM table;
SELECT state, region, pop FROM table;
SELECT state WHERE pop > 20;
SELECT state FROM non_existent_table;
SELECT state, pop;
SELECT state FROM table WHERE non_existent_column > 20;
SELECT state FROM table WHERE region = 'South' AND (pop > 20 OR pop_male > 10);
SELECT state FROM table;
SELECT state FROM table LIMIT twenty;
SELECT state FROM table LIMIT 1000000;
SELECT state FROM table WHERE (region = 'South');
SELECT state FROM table WHERE region = 'South';
SELECT state FROM table WHERE;