-
Notifications
You must be signed in to change notification settings - Fork 41
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
3290337
commit afc48f1
Showing
7 changed files
with
49 additions
and
137 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
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
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,3 +1,4 @@ | ||
dune-client==1.3.0 | ||
pyyaml | ||
python-dotenv | ||
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
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 pandas as pd | ||
|
||
dotenv_path = os.path.join(os.path.dirname(__file__), '..', '.env') | ||
load_dotenv(dotenv_path) | ||
|
||
dune = DuneClient.from_env() | ||
|
||
#get id passed in python script invoke | ||
id = sys.argv[1] | ||
|
||
query_file = os.path.join(os.path.dirname(__file__), '..', 'queries', f'query_{id}.sql') | ||
|
||
print('getting 20 line preview for query {}...'.format(id)) | ||
|
||
with open(query_file, 'r', encoding='utf-8') as file: | ||
query_text = file.read() | ||
|
||
results = dune.run_sql(query_text + '\n limit 20') | ||
# print(results.result.rows) | ||
results = pd.DataFrame(data=results.result.rows) | ||
print('\n') | ||
print(results) | ||
print('\n') | ||
print(results.describe()) | ||
print('\n') | ||
print(results.info()) |