Set up a new repo from the GitHub template
Use this GitHub template to create your own repository, then follow these steps:-
Generate an API key from your Dune account and put that in both your
.envfile and github action secrets (name itDUNE_API_KEY). You can create a key under your Dune team settings. The api key must be from a plus plan for this repo to work. -
Type your intended query ids into the
queries.ymlfile. The id can be found from the linkhttps://dune.com/queries/<query_id>/.... If you’re creating this for a dashboard, go to the dashboard you want to create a repo and click on the “github” button in the top right of your dashboard to see the query ids. -
Then, run
pull_from_dune.pyto bring in all queries into/query_{id}.sqlfiles within the/queriesfolder. Directions to setup and run this python script are below.
Updating Queries or CSV Tables
-
Make any changes you need to directly in the repo. Any time you push a commit to MAIN branch,
push_to_dune.pywill save your changes into Dune directly. You can run this manually too if you want. -
For CSVs, update the files in the
/uploadsfolder.upload_to_dune.pywill run on commit, or can be run manually. The table name in Dune will bedune.team_name.dataset_<filename>.
You can press the “github” button on your own dashboard to get a list of query ids, or you can just paste in any query ids yourself. The query id comes from the url,
dune.com/queries/<query_id>/<visualization_id>.pull_from_dune.py anytime to update the repo with any changes from the app.
