Skip to content

rentruewang/inversql


Unit Testing Pre Commit Checks Publish

PyPI MIT

🔄 InverSQL

Generate SQL that match your selection, with decision trees

  1. User doesn't want to write SQL.
  2. User uploads CSV to 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
Quick Demo Link to live demo site here. Architecture Diagram

🏎️ 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.

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: BuyMeACoffee

If you REALLY like my work, nowadays I'm working on aioway, it's an optimizing compiler approach to deep learning, check it out!

👨‍👨‍👦‍👦 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.

About

Create SQL that match your selection (with explainable AI), not the other way around

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages