-
Notifications
You must be signed in to change notification settings - Fork 21
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
Conversation
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
+1
results = dune.get_latest_result(1215383, max_age_hours=8) | ||
query_result = pd.DataFrame(query_result.result.rows) |
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.
@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
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.
can you update the jupyter notebook to use get_latest_result_dataframe()
where appropriate.
:-)
thanks, approving it so you don't have to wait for another review
@@ -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) |
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.
results = dune.get_latest_result(1215383, max_age_hours=8) | |
query_results = dune.get_latest_result_dataframe(1215383) |
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.
closing this PR, it is stale by now |
No description provided.