-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Devrel rework - add example notebook #99
Changes from all commits
f7c11a4
9eaa1a0
1a53c09
3a14446
5396fad
c9aa397
10dab47
1a0b487
82258b1
53c500c
1f13b73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ _version.py | |
venv/ | ||
tmp/ | ||
.vscode/ | ||
examples/.env.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,10 +57,12 @@ Use `get_latest_results` to get the most recent query results without using exec | |
You can specify a `max_age_hours` to re-run the query if the data is too outdated. | ||
|
||
```python | ||
import pandas as pd | ||
from dune_client.client import DuneClient | ||
|
||
dune = DuneClient.from_env() | ||
results = dune.get_latest_result(1215383, max_age_hours=8) | ||
query_result = pd.DataFrame(query_result.result.rows) | ||
Comment on lines
64
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @andrewhong5297 I've implemented a helper function in this PR that uses the latest result API and returns a dataframe directly. It should be more efficient than using get_latest_result(), since that one has to parse the results in json format, while the new one uses the CSV endpoint which is a lot more efficient when parsing into a dataframe and is a streaming endpoint on top of that |
||
``` | ||
|
||
## Paid Subscription Features | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tiny nit: Can you please use lowercase filenames without spaces (probably best to use underscores)? I hate having to deal with spaces on the command line 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Dune Python API Examples | ||
|
||
Here you can find some examples of working with the Dune API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suggested change breaks the context of the readme. Specifically demonstrating the use of max age.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the csv endpoint can't support max age, since it doesn't return any metadata about the execution :/ One would need to call the status endpoint first to check the age and then the get csv endpoint. I think it would still be more efficient though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine, but then the readme should probably be changed to remove the max age example.