The Brief
A consultancy has been handed a stack of CSV files from a legacy system and asked to deliver "a query layer". They cannot stand up a database server, they cannot install third-party packages — air-gapped client environment. The only tool available is Python.
Build a working SQL engine in pure standard library. Tokenize the input, parse it into an AST, then execute it against in-memory tables loaded from CSV.
Must support: SELECT col, col, * FROM table; WHERE col OP value with =, !=, <, >, <=, >= and AND/OR; INNER JOIN table ON col = col; ORDER BY col [ASC|DESC]; LIMIT n. Values may be strings (single-quoted), integers, or floats. Identifiers are case-sensitive; SQL keywords are case-insensitive. This is the legendary tier — build the lot.