Skip to content
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

Closed
wants to merge 11 commits into from
Closed

Conversation

andrewhong5297
Copy link
Contributor

No description provided.

Copy link
Member

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 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment on lines 64 to +65
results = dune.get_latest_result(1215383, max_age_hours=8)
query_result = pd.DataFrame(query_result.result.rows)
Copy link
Member

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

Copy link
Collaborator

@msf msf left a 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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
results = dune.get_latest_result(1215383, max_age_hours=8)
query_results = dune.get_latest_result_dataframe(1215383)

Copy link
Collaborator

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.

Copy link
Member

@TheEdgeOfRage TheEdgeOfRage Oct 12, 2023

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.

Copy link
Collaborator

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.

@msf
Copy link
Collaborator

msf commented Jul 17, 2024

closing this PR, it is stale by now

@msf msf closed this Jul 17, 2024
@bh2smith bh2smith deleted the devrel-rework branch July 17, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants