Show HN: InverSQL: Build SQL interactively in inverse Developer rentruewang released InverSQL, an open-source Streamlit app that generates SQL queries from CSV uploads by overfitting a scikit-learn decision tree, converting it to boolean logic with sympy, and simplifying it into SQL. The tool, demonstrated at inversql.streamlit.app, lets users select cells to define query results without writing SQL, and the author is also promoting a related project, aioway, an automated training and inference engine. 1. User doesn't want to write SQL. 2. User uploads CSV to inversql streamlit app https://inversql.streamlit.app 3. User selects cells that will be selected by the SQL . 4. We overfit a scikit-learn binary decision tree on the data. 5. We decompose the tree, convert to boolean logic explainable AI part . 6. We simplify the logic with sympy . 7. Generate SQL from previous steps joins to JOIN and boolean to WHERE . 8. User sees the SQL. 9. User is happy. | 🎬 Demo in a GIF | 🏛️ Architecture diagram | |---|---| | Link to /rentruewang/inversql/blob/main/assets/quick-demo.gif live demo site https://inversql.streamlit.app here. | | For each individual SQL query candidate the shortest one is displayed in the UI , we need to retrain a new decision tree. But... The decision tree fitting is honestly fast, don't worry about this. That's pretty much it If you have read this far, please consider giving me a star ⭐ https://github.com/rentruewang/inversql/stargazers or a fork 🍴 . This will keep my motivation going Or if you have too much cash at hand: If you REALLY like my work, nowadays I'm working on aioway https://github.com/rentruewang/aioway , it's an automated training and inference engine that does the following: - Adapt to hardware it runs on optimal hardware usage - Adapt to data it trains on figure out architecture on its own - Incremental training never overfit or underfit Contribution welcome To contribute, refer to CONTRIBUTING.md /rentruewang/inversql/blob/main/CONTRIBUTING.md , and our CODE OF CONDUCT.md /rentruewang/inversql/blob/main/CODE OF CONDUCT.md . Inspired by regexgen https://github.com/devongovett/regexgen how-does-it-work 's process. Instead of regex we do SQL. Instead of selecting text we do select records. Decision tree is my inspiration tho.