Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhong5297 committed Nov 28, 2023
1 parent 3a77dfe commit 851de88
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 60 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/update_to_dune.yml

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ A template for creating repos to manage your Dune queries using the CRUD API.

### 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 get a popup which will display all your query ids for said dashboard. Or, just get the list queries you want to track in general.
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 get a popup which will display all your query ids for said dashboard.
- Alternatively, just get the list queries you want to track if you aren't doing this for a dashboard.

2. Copy and paste that list into the `queries.yml` file.

Expand Down
3 changes: 0 additions & 3 deletions queries/query_3237721.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
-- DEX by volume 🏦
-- https://dune.com/queries/3237721

WITH
seven_day_volume AS (
SELECT
Expand Down
4 changes: 0 additions & 4 deletions queries/query_3237723.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
-- Weekly DEX volume by chain
-- https://dune.com/queries/3237723


SELECT
blockchain,
DATE_TRUNC('week', block_time),
Expand Down
4 changes: 0 additions & 4 deletions queries/query_3237726.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
-- Aggregator by volume 📢
-- https://dune.com/queries/3237726


WITH
seven_day_volume AS (
SELECT
Expand Down
4 changes: 0 additions & 4 deletions queries/query_3237738.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
-- Weekly DEX volume
-- https://dune.com/queries/3237738


SELECT
project,
DATE_TRUNC('week', block_time),
Expand Down
4 changes: 0 additions & 4 deletions queries/query_3237742.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
-- Weekly DEX Aggregator volume
-- https://dune.com/queries/3237742


SELECT
project,
DATE_TRUNC('week', block_time),
Expand Down
4 changes: 0 additions & 4 deletions queries/query_3237745.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
-- EVM DEX Traders by Bucket
-- https://dune.com/queries/3237745


with
all_traders as (
SELECT
Expand Down
11 changes: 7 additions & 4 deletions scripts/update_from_dune.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
file_path = os.path.join(os.path.dirname(__file__), '..', 'queries', f'query_{query.base.query_id}.sql')
if os.path.exists(file_path):
# Update existing file
with open(file_path, 'r+', encoding='utf-8') as file:
file.truncate(0) # Delete all file contents
file.write(f'-- {query.base.name}\n-- https://dune.com/queries/{query.base.query_id}\n\n\n{query.sql}')
with open(file_path, 'r+', encoding='utf-8') as file:
#if "query repo:" is in the file, then don't add the text header again
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}')
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'-- {query.base.name}\n-- 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 851de88

Please sign in to comment.