-
Notifications
You must be signed in to change notification settings - Fork 25
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
Refactor: DuneInterface.refresh return type #26
Conversation
def __hash__(self) -> int: | ||
""" | ||
This contains the query ID and the values of relevant parameters. | ||
Thus, it is unique for caching purposes | ||
""" | ||
return self.url().__hash__() |
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.
Like this idea for hashing!
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.
Unfortunately this did not work out as I had expected:
query_id: int | ||
name: Optional[str] = "unnamed" |
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.
Also liked you've added the name. Going to be using this in the excel export!
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.
The name was always here, but this just makes it optional with a default value so that it's less annoying when you don't want to use it.
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.
LGTM!
This is an interface breaking change so we will have to bump the version to 0.1.0 |
In order for users to cache results, they need access to the JOB ID of their execution. The refresh method now returns more enriched data giving these advanced options to the user.
We lost the convenience of not having to check for an optional field, but introduced a similar convenience in the
ResultsResponse
(i.e. the new methodget_rows
which performs the necessary assertion check) and always returns a list of dune records.Bonus feature is the Query__hash__ implementation which will allow people to cache results of different executions of the same query with different parameters.
Closes #25 and closes #27