Registry / data / dune-client

dune-client

JSON →
library1.11.2pypypi✓ verified 86d ago

Official Python SDK for the Dune Analytics API. Version 1.10.0 supports async/sync clients, direct SQL execution, Pipeline API, Uploads, and Datasets. Backward-incompatible changes include removal of from_env() and custom_endpoints.

pip install dune-client
INSTALL
IMPORT
SIG · DUNE-CLIENT
D
dune-client
datapythonv1.11.2
Install
5.4s avg
Import
783ms
Disk
33MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.7.10 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.824s · 34.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.4s · import 0.742s · 37MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DuneClient
from dune_client.client import DuneClient
from dune_client import DuneClient
DuneClient is in the client submodule, not top-level
AsyncDuneClient
from dune_client.async_client import AsyncDuneClient

Initialize client with API key, fetch latest query result, and refresh a query with parameters.

import os from dune_client.client import DuneClient from dune_client.types import QueryParameter api_key = os.environ.get("DUNE_API_KEY", "") if not api_key: raise ValueError("Set DUNE_API_KEY environment variable") client = DuneClient(api_key) # Execute a query by ID result = client.get_latest_result(12345) print(result) # Execute a query with parameters params = [QueryParameter.text_type(name="network", value="ethereum")] result = client.refresh(12345, params=params) print(result)
Debug
Known issues
breakingfrom_env() classmethod removed in v1.8.0; use explicit DuneClient(api_key) instead.
fix
Replace DuneClient.from_env() with DuneClient(os.getenv('DUNE_API_KEY'))
affects: >=1.8.0
breakingcustom_endpoints parameter removed in v1.9.1; use environment variable DUNE_API_BASE_URL.
fix
Set DUNE_API_BASE_URL env var, or use client = DuneClient(api_key, base_url='https://custom.api.dune.com')
affects: >=1.9.1
deprecatedlegacy Table API (create_table, insert_table, etc.) deprecated in v1.10.0; use Uploads and Datasets APIs.
fix
Migrate to client.upload_csv() and client.create_dataset() per official docs.
affects: >=1.10.0
gotchaDuneClient is thread-safe but not fork-safe; do not use with multiprocessing without reinitializing.
fix
Create a new DuneClient instance per process.
affects: >=1.0.0
gotchaAPI key must be from Dune Analytics (not Etherscan); use personal API key from https://dune.com/settings/api
fix
Generate API key at https://dune.com/settings/api
affects: >=1.0.0
Errors
Common errors & fixes
from dune_client import DuneClient ImportError: cannot import name 'DuneClient' from 'dune_client'
DuneClient is in the client submodule.
fix
Use: from dune_client.client import DuneClient
AttributeError: 'DuneClient' object has no attribute 'from_env'
from_env() removed in v1.8.0.
fix
Use: DuneClient(os.getenv('DUNE_API_KEY'))
dune_client.client.DuneAuthenticationError: API key not found
API key not provided or empty.
fix
Set DUNE_API_KEY environment variable or pass key argument.
Upgrade
Version history
1.11.2latest on PyPI · released Jun 9, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
30 hits · last 30 days
node
28
Bingbot
1
OpenAI (training)
1
Resources
dune-client — pip install dune-client · libregistry