generated from duneanalytics/DuneQueryRepo
-
Notifications
You must be signed in to change notification settings - Fork 9
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
90a23ea
commit bdd4c47
Showing
10 changed files
with
128 additions
and
54 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#copy and paste this file into a .env file to run scripts locally. You will also need to add the DUNE_API_KEY into the repo settings under "Secrets and Variables" | ||
#copy and paste this file into a .env file to run scripts locally. You will also need to add the DUNE_API_KEY and DUNE_API_BASE_URL into the repo settings under "Secrets and Variables" | ||
|
||
#add a dune API key - you can create one under team settings (https://dune.com/settings/teams/manage/{team_name}/api). You must be on the premium plan. | ||
DUNE_API_KEY= | ||
DUNE_API_KEY= | ||
DUNE_API_BASE_URL=https://api.dune.com |
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: Upload CSVs to Dune on Commit | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'queries/**' | ||
|
||
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, by overwriting queries with repo query text | ||
env: | ||
DUNE_API_KEY: ${{ secrets.DUNE_API_KEY }} | ||
DUNE_API_BASE_URL: ${{ secrets.DUNE_API_BASE_URL }} | ||
run: python -u scripts/upload_to_dune.py |
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
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,14 @@ | ||
query_ids: | ||
- 4235 | ||
- 8243 | ||
- 14138 | ||
- 7486 | ||
- 4319 | ||
- 21693 | ||
- 4323 | ||
- 1847 | ||
- 4388 | ||
- 2180075 | ||
- 4424 | ||
- 21689 | ||
- 4234 |
This file was deleted.
Oops, something went wrong.
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,4 +1,4 @@ | ||
dune-client==1.3.0 | ||
dune-client | ||
pyyaml | ||
python-dotenv | ||
pandas |
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
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
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
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,30 @@ | ||
import os | ||
from dune_client.client import DuneClient | ||
from dotenv import load_dotenv | ||
import sys | ||
import codecs | ||
import os | ||
|
||
# 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() | ||
|
||
uploads_path = os.path.join(os.path.dirname(__file__), '..', 'uploads') | ||
files = os.listdir(uploads_path) | ||
|
||
for file in files: | ||
if not file.endswith(".csv"): | ||
continue | ||
file_name = file.split(".")[0].lower().replace(' ', '_') | ||
with open(os.path.join(uploads_path, file), 'r') as file: | ||
table = dune.upload_csv( | ||
data=str(file.read()), | ||
table_name=file_name, | ||
is_private=False | ||
) | ||
print(f'uploaded table "{file_name}"') | ||
|