Generate SQL that match your selection, with decision trees
- User doesn't want to write SQL.
- User uploads CSV to inversql streamlit app
- User selects cells (that will be selected by the SQL).
- We overfit a
scikit-learnbinary decision tree on the data. - We decompose the tree, convert to boolean logic (explainable AI part).
- We simplify the logic with
sympy. - Generate SQL from previous steps (joins to JOIN and boolean to WHERE).
- User sees the SQL.
- User is happy.
| 🎬 Demo in a GIF | 🏛️ Architecture diagram |
|---|---|
Link to
live demo site
here.
|
|
🏎️ Performance
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.
🌟 Give us a star!
That's pretty much it!
If you have read this far, please consider giving me a star (⭐) 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, 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)
👨👨👦👦 Contributors
Contribution welcome!
To contribute, refer to CONTRIBUTING.md, and our CODE_OF_CONDUCT.md.
🎨 Inspiration.
Inspired by regexgen's process. Instead of regex we do SQL. Instead of selecting text we do select records. Decision tree is my inspiration tho.












