Skip to content

Commit

Permalink
update queries
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhong5297 committed Nov 28, 2023
1 parent cd9802e commit 9f85a4d
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 6 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
5 changes: 5 additions & 0 deletions queries/query_3237721.sql
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions queries/query_3237723.sql
Original file line number Diff line number Diff line change
@@ -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),
Expand Down
5 changes: 5 additions & 0 deletions queries/query_3237726.sql
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions queries/query_3237738.sql
Original file line number Diff line number Diff line change
@@ -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),
Expand Down
5 changes: 5 additions & 0 deletions queries/query_3237742.sql
Original file line number Diff line number Diff line change
@@ -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),
Expand Down
5 changes: 5 additions & 0 deletions queries/query_3237745.sql
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions scripts/pull_from_dune.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')


0 comments on commit 9f85a4d

Please sign in to comment.