Installation
To install the SDK, run the following command in your terminal:Quick Start
Initialize the client with your API key:Working with Queries
You will commonly work with theQueryBase class which can be created like this:
QueryBase and all properties can be found in this file.
Executing Queries
Execute a query and get results:dune.run_sql(query_sql="SELECT 1 AS value"). Both methods wait for completion and return ResultsResponse. The older execute(query) method only submits an execution; it does not fetch result rows. For query parameters, pass QueryBase(query_id=..., params=[QueryParameter.text_type(name="blockchain", value="ethereum")]) to run_query.
Working with Results
Read rows withresults.get_rows() or results.result.rows when a result is present. The SDK’s high-level run_query method retrieves all pages. See the response models.
dune.get_latest_result(query_id, max_age_hours=8) may rerun a query when its saved result is older than eight hours. A rerun consumes execution credits.
Using Pandas DataFrames
If you are trying to load data into a Pandas DataFrame, you can use the following function from the SDK:Additional Resources
GitHub Repository
View source code, examples, and full documentation
API Files
Explore the API implementation
Releases
Check the latest release versions
Report Issues
Report bugs or request features