-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c1c2ee
commit b451036
Showing
5 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Python CI | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Log directory structure | ||
run: | | ||
pwd | ||
ls -R | ||
- name: pip requirements | ||
run: pip install -r requirements.txt | ||
|
||
- name: Update all queries from Dune | ||
env: | ||
DUNE_API_KEY: ${{ secrets.DUNE_API_KEY }} | ||
run: python -u github_workflows/update_to_dune.py | ||
|
||
- name: Print name | ||
run: echo "Hello ${{ secrets.ENV_TEST }}" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import os | ||
import yaml | ||
from dune_client.client import DuneClient | ||
from dotenv import load_dotenv | ||
import sys | ||
import codecs | ||
|
||
# Set the default encoding to UTF-8 | ||
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) | ||
|
||
dotenv_path = os.path.join(os.path.dirname(__file__), '..', '.env') | ||
load_dotenv(dotenv_path) | ||
|
||
dune = DuneClient.from_env() | ||
|
||
# Read the queries.yml file | ||
with open('queries.yml', 'r', encoding='utf-8') as file: | ||
data = yaml.safe_load(file) | ||
|
||
# Extract the query_ids from the data | ||
query_ids = [id for id in data['query_ids']] | ||
|
||
for id in query_ids: | ||
query = dune.get_query(id) | ||
print('updating query {}, {}'.format(query.base.query_id, query.base.name)) | ||
|
||
# Check if file exists | ||
file_path = os.path.join(os.path.dirname(__file__), '..', 'queries', f'query_{query.base.query_id}.sql') | ||
if os.path.exists(file_path): | ||
# Read the content of the file | ||
with open(file_path, 'r', encoding='utf-8') as file: | ||
text = file.read() | ||
|
||
# Update existing file | ||
dune.update_query( | ||
query_id, | ||
# All parameters below are optional | ||
query_sql=text, | ||
) | ||
|
||
else: | ||
print('file not found, {}'.format(query_{query.base.query_id}.sql)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
-- DEX by volume 🏦 | ||
-- https://dune.com/queries/3237721 | ||
|
||
--andrew is testing actions | ||
|
||
WITH | ||
seven_day_volume AS ( | ||
|