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

Reading custom endpoint results SDK support #132

Merged
merged 10 commits into from
Jun 20, 2024

Conversation

philippWassibauer
Copy link
Contributor

@philippWassibauer philippWassibauer commented Jun 16, 2024

This allows for fetching custom-endpoint results. example:

from dune_client.client import DuneClient
dune = DuneClient(api_key='***')
response = dune.get_custom_endpoint_result("<handle>", "<endpoint>", limit = 100)

Todo: add some testing

@philippWassibauer philippWassibauer changed the title reading custom endpoint results works locally. Reading custom endpoint results SDK support Jun 16, 2024
Copy link
Collaborator

@bh2smith bh2smith left a comment

Choose a reason for hiding this comment

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

Looks good so far. Looking forward to some tests!

dune_client/api/custom.py Outdated Show resolved Hide resolved
dune_client/api/custom.py Outdated Show resolved Hide resolved
dune_client/api/extensions.py Show resolved Hide resolved
philippWassibauer and others added 4 commits June 17, 2024 09:14
Co-authored-by: Benjamin Smith <bh2smith@users.noreply.github.com>
@philippWassibauer philippWassibauer marked this pull request as ready for review June 17, 2024 09:19
@@ -12,7 +12,7 @@
ResultsResponse,
)


# pylint: disable=duplicate-code
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is likely because of all the filter arguments and suggests a deeper change to the project. Introduce a ResultFilter structure that contains all the filtering possibilities:

@dataclass
class ResultFilter:
    limit: Optional[int] = None
    offset: Optional[int] = None
    columns: Optional[List[str]] = None
    sample_count: Optional[int] = None
    filters: Optional[str] = None
    sort_by: Optional[List[str]] = None

Then here would look more like:

    def get_custom_endpoint_result(
        self,
        handle: str,
        endpoint: str,
        filter: Optional[ResultFilter]
    ) -> ResultsResponse:

It would resolve both duplicated code lint warning and also reduce the "argument overload" lint error that is being globally suppressed here

max-args=10

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will log this and do at another time.

@philippWassibauer philippWassibauer merged commit 775549b into main Jun 20, 2024
3 checks passed
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