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

Feature: Download CSV #73

Merged
merged 1 commit into from
Sep 8, 2023
Merged

Feature: Download CSV #73

merged 1 commit into from
Sep 8, 2023

Conversation

bh2smith
Copy link
Collaborator

@bh2smith bh2smith commented Sep 6, 2023

This method is similar to that of get_latest_resultsexcept that it returns in CSV format as outlined here: https://dune.com/docs/api/api-reference/get-results/latest-results/

I noticed that the docs don't give example responses of the csv route.

A few things were updated here (url to api docs on get_latest_results).

We created a utility function to avoid tripling the same code block that handles query objects or types. Functionality is now unit tested.

Closes #66

cc @TheEdgeOfRage & @diegoximenes for additional review.

@bh2smith bh2smith force-pushed the download-csv branch 2 times, most recently from 94d0546 to b2204fa Compare September 7, 2023 07:40
@bh2smith bh2smith requested a review from msf September 7, 2023 09:10
@bh2smith bh2smith force-pushed the download-csv branch 2 times, most recently from fde63d9 to f1fec83 Compare September 7, 2023 12:22
dune_client/api/extensions.py Outdated Show resolved Hide resolved
tests/e2e/test_client.py Outdated Show resolved Hide resolved
url = self._route_url(f"/execution/{job_id}/results/csv")
self.logger.debug(f"GET CSV received input url={url}")
response = self._get(route=route, raw=True)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was unnecessary because the _get method does this same debug logging.

Comment on lines -107 to +84
https://dune.com/docs/api/api-reference/latest_results/
https://dune.com/docs/api/api-reference/get-results/latest-results
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

URL has changed since last time.

pandas.from_csv(data)
pandas.read_csv(data)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a typo.

tests/e2e/test_client.py Outdated Show resolved Hide resolved
Base automatically changed from split-client-class to main September 8, 2023 10:33
@bh2smith bh2smith changed the base branch from main to reduce-e2e September 8, 2023 10:48
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.

ship it

@bh2smith bh2smith merged commit d0dc172 into reduce-e2e Sep 8, 2023
3 checks passed
bh2smith added a commit that referenced this pull request Sep 8, 2023
* only run e2e on one python version (fewer requests)

* add download_csv functionality (#73)
@bh2smith bh2smith deleted the download-csv branch September 8, 2023 11:36
@bh2smith bh2smith mentioned this pull request Sep 8, 2023
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.

3 participants