From 9f85a4de22de9924c441f49f6baa458198448cff Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Tue, 28 Nov 2023 17:11:46 -0500 Subject: [PATCH] update queries --- README.md | 7 +++---- queries/query_3237721.sql | 5 +++++ queries/query_3237723.sql | 5 +++++ queries/query_3237726.sql | 5 +++++ queries/query_3237738.sql | 5 +++++ queries/query_3237742.sql | 5 +++++ queries/query_3237745.sql | 5 +++++ scripts/pull_from_dune.py | 4 ++-- 8 files changed, 35 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bcbab41..dccd301 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,12 @@ # Query Repo -A template for creating repos to manage your Dune queries using the CRUD API. +A template for creating repos to manage your Dune queries using the CRUD API. The main flow I've created this template for is to turn any dashboard you own into a repository of queries. But you can extend it however you want. ### Setup -1. First, go to the dashboard you want to create a repo for (must be owned by you/your team). Click on the "github" icon in the top right to see your query ids. - - Or if you aren't doing this for a dashboard, just get the list queries you want to manage. +1. First, go to the dashboard you want to create a repo for (must be owned by you/your team). Click on the "github" icon in the top right to see your query ids. -2. Copy and paste that list into the `queries.yml` file. +2. Copy and paste that list into the `queries.yml` file (or any list of query ids, doesn't have to be from a dashboard). 3. Install the python requirements and run the `pull_from_dune.py` script. You can input the following lines into a terminal/CLI: diff --git a/queries/query_3237721.sql b/queries/query_3237721.sql index 0298460..fceebb5 100644 --- a/queries/query_3237721.sql +++ b/queries/query_3237721.sql @@ -1,3 +1,8 @@ +-- already part of a query repo +-- query name: DEX by volume 🏦 +-- query link: https://dune.com/queries/3237721 + + WITH seven_day_volume AS ( SELECT diff --git a/queries/query_3237723.sql b/queries/query_3237723.sql index 568cdc1..6f0b19c 100644 --- a/queries/query_3237723.sql +++ b/queries/query_3237723.sql @@ -1,3 +1,8 @@ +-- already part of a query repo +-- query name: Weekly DEX volume by chain +-- query link: https://dune.com/queries/3237723 + + SELECT blockchain, DATE_TRUNC('week', block_time), diff --git a/queries/query_3237726.sql b/queries/query_3237726.sql index 851be75..c0e5b4d 100644 --- a/queries/query_3237726.sql +++ b/queries/query_3237726.sql @@ -1,3 +1,8 @@ +-- already part of a query repo +-- query name: Aggregator by volume 📢 +-- query link: https://dune.com/queries/3237726 + + WITH seven_day_volume AS ( SELECT diff --git a/queries/query_3237738.sql b/queries/query_3237738.sql index 8b5c65d..1cf0d80 100644 --- a/queries/query_3237738.sql +++ b/queries/query_3237738.sql @@ -1,3 +1,8 @@ +-- already part of a query repo +-- query name: Weekly DEX volume +-- query link: https://dune.com/queries/3237738 + + SELECT project, DATE_TRUNC('week', block_time), diff --git a/queries/query_3237742.sql b/queries/query_3237742.sql index f2d5ec2..1413083 100644 --- a/queries/query_3237742.sql +++ b/queries/query_3237742.sql @@ -1,3 +1,8 @@ +-- already part of a query repo +-- query name: Weekly DEX Aggregator volume +-- query link: https://dune.com/queries/3237742 + + SELECT project, DATE_TRUNC('week', block_time), diff --git a/queries/query_3237745.sql b/queries/query_3237745.sql index d2d8a49..4cd793a 100644 --- a/queries/query_3237745.sql +++ b/queries/query_3237745.sql @@ -1,3 +1,8 @@ +-- already part of a query repo +-- query name: EVM DEX Traders by Bucket +-- query link: https://dune.com/queries/3237745 + + with all_traders as ( SELECT diff --git a/scripts/pull_from_dune.py b/scripts/pull_from_dune.py index 26802f5..0a88dbb 100644 --- a/scripts/pull_from_dune.py +++ b/scripts/pull_from_dune.py @@ -33,11 +33,11 @@ if '-- already part of a query repo' in query.sql: file.write(query.sql) else: - file.write(f'-- already part of a query repo\n --query name: {query.base.name}\n-- query link: https://dune.com/queries/{query.base.query_id}\n\n\n{query.sql}') + file.write(f'-- already part of a query repo\n-- query name: {query.base.name}\n-- query link: https://dune.com/queries/{query.base.query_id}\n\n\n{query.sql}') else: # Create new file and directories if they don't exist os.makedirs(os.path.dirname(file_path), exist_ok=True) with open(file_path, 'w', encoding='utf-8') as file: - file.write(f'-- already part of a query repo\n --query name: {query.base.name}\n-- query link: https://dune.com/queries/{query.base.query_id}\n\n\n{query.sql}') + file.write(f'-- already part of a query repo\n-- query name: {query.base.name}\n-- query link: https://dune.com/queries/{query.base.query_id}\n\n\n{query.sql}')