Skip to content

Commit

Permalink
fix parameters (boolean as string)
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed Aug 26, 2024
1 parent 065d19b commit f40fdab
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dune_client/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _build_parameters(
sort_by: Optional[List[str]] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
allow_partial_results: bool = True,
allow_partial_results: str = "true",
) -> Dict[str, Union[str, int]]:
"""
Utility function that builds a dictionary of parameters to be used
Expand Down
2 changes: 1 addition & 1 deletion dune_client/api/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_execution_results(
sample_count: Optional[int] = None,
filters: Optional[str] = None,
sort_by: Optional[List[str]] = None,
allow_partial_results: bool = True,
allow_partial_results: str = "true",
) -> ResultsResponse:
"""GET results from Dune API for `job_id` (aka `execution_id`)"""
params = self._build_parameters(
Expand Down
4 changes: 3 additions & 1 deletion dune_client/api/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def run_query(
sample_count: Optional[int] = None,
filters: Optional[str] = None,
sort_by: Optional[List[str]] = None,
allow_partial_results: bool = True,
allow_partial_results: str = "true",
) -> ResultsResponse:
"""
Executes a Dune `query`, waits until execution completes,
Expand Down Expand Up @@ -418,6 +418,8 @@ def _refresh(
)
time.sleep(ping_frequency)
status = self.get_execution_status(job_id)
if status.state == ExecutionState.PENDING:
self.logger.warning("Partial result set retrieved.")
if status.state == ExecutionState.FAILED:
self.logger.error(status)
raise QueryFailed(f"Error data: {status.error}")
Expand Down
1 change: 1 addition & 0 deletions dune_client/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ async def _get() -> Any:
headers=self.default_headers(),
params=params,
)
print(response)
if raw:
return response
return await self._handle_response(response)
Expand Down
1 change: 1 addition & 0 deletions dune_client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ class ResultsResponse:
@classmethod
def from_dict(cls, data: dict[str, str | int | ResultData]) -> ResultsResponse:
"""Constructor from dictionary. See unit test for sample input."""
print(data)
assert isinstance(data["execution_id"], str)
assert isinstance(data["query_id"], int)
assert isinstance(data["state"], str)
Expand Down

0 comments on commit f40fdab

Please sign in to comment.