Skip to main content

Crate dnapi

Crate dnapi 

Source
Expand description

Dune Analytics API client for Rust

An unofficial Rust client for the Dune Analytics API.

§Example

let client = dnapi::Client::new("your-api-key")?;

// Execute a query and wait for results
let result = client.executions().run_query(1234, None).await?;
for row in result.result.unwrap().rows {
    println!("{:?}", row);
}

// Execute raw SQL
let result = client.executions().run_sql("SELECT 1 as value", None).await?;
println!("{:?}", result.result);

// Get cached results for a query
let result = client.executions().query_results(1234).await?;
println!("{:?}", result.result);

§Features

  • Queries: Create, read, update, archive/unarchive queries
  • Executions: Execute queries, run SQL, get results (JSON or CSV)
  • Tables: Upload data, create tables, insert rows
  • Materialized Views: Create, refresh, manage materialized views
  • Pipelines: Execute coordinated query workflows
  • Usage: Track API consumption and credits

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

error
Error types for the Dune API client
executions
Executions API for running queries and retrieving results
matviews
Materialized Views API for creating and managing materialized views
pipelines
Pipelines API for executing coordinated query workflows
queries
Queries API for managing Dune queries
tables
Tables API for uploading and managing custom data
usage
Usage API for tracking API consumption and credits

Structs§

Client
Dune Analytics API client
Config
Configuration for the Dune API client
HttpClientConfig
HTTP client configuration
RetryConfig
Configuration for retry behavior
RetryError
Error wrapper that includes retry information

Constants§

DEFAULT_BASE_URL
Default base URL for the Dune Analytics API

Traits§

RetryableError
Determines if an error should be retried

Functions§

config_with_api_key
Create a config with an API key
with_retry
Execute an async operation with retries
with_simple_retry
Simple retry wrapper for operations that return Result with any error type