Coder Social home page Coder Social logo

Perdedune

Automagically parse queries from a dashboard to remove duplicate sets and streamline your code!

perdedune tool demo

asciicast

Usage:

Run the following commands in your terminal:

git clone https://github.com/perdedune/perdedune/ ./perdedune
cd perdedune
pip install -r requirements.txt

python main.py "https://dune.com/perdedune/perdedune"
# new directory perdedune_perdedune was created

python find_common_sql.py perdedune_perdedune
# abstractions(common sql statements) and unique select statements written to perdedune_perdedune/output

Output:

  • main.py will extract a number of user_dashboard/input/*.sql files, representing the existing SQL logic for all queries in the dashboard.
  • find_common_sql.py analyses the sql files generated by main.py, and outputs a more optimal solution under user_dashboard/output/*.sql.

Architecture:

Sample data

In order to validate our process, we sampled an existing Dune table using the Dune API. The script and sample data are available at /sample_data. To re-extract, simply run /sample_data/sample_data.py.

Known limitations:

  • At the moment, the process is limited to CTE, and queries.
  • Further, the process currently assumes a unique CTE alias scheme.

perdedune's Projects

database icon database

pgSQL database for perdedune process validation

perdedune icon perdedune

Automagically parse all queries from a dashboard to generate abstraction sets and streamline your code!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.