ScyllaDB Rust Driver
Async CQL driver for Rust, optimized for ScyllaDB and fully compatible with Apache Cassandra
Build high-performance database applications with type-safe serialization, token-aware routing, and zero-copy deserialization
Quick start
Get up and running with the ScyllaDB Rust Driver in minutes
Add the dependency
Add the scylla crate to your Cargo.toml:[dependencies]
scylla = "1.5"
tokio = { version = "1", features = ["full"] }
Create a session
Connect to your ScyllaDB or Cassandra cluster:use scylla::client::session::{Session, SessionBuilder};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let session: Session = SessionBuilder::new()
.known_node("127.0.0.1:9042")
.build()
.await?;
Ok(())
}
Execute queries
Run your first CQL query:// Create a keyspace
session
.query_unpaged(
"CREATE KEYSPACE IF NOT EXISTS ks WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1}",
&[]
)
.await?;
// Insert data
session
.query_unpaged(
"INSERT INTO ks.users (id, name) VALUES (?, ?)",
(1_i32, "Alice")
)
.await?;
// Query data
let rows = session
.query_unpaged("SELECT id, name FROM ks.users", &[])
.await?
.into_rows_result()?;
for row in rows.rows()? {
let (id, name): (i32, String) = row?;
println!("User: id={}, name={}", id, name);
}
The driver automatically prepares statements, handles retries, and routes queries to the optimal nodes.
Key features
Everything you need to build high-performance database applications
Async & Fast
Built on Tokio with zero-copy deserialization for maximum performance
Type Safe
Compile-time type checking with derive macros for serialization
Smart Routing
Token-aware, shard-aware, and tablet-aware routing to minimize latency
Prepared Statements
Automatic statement preparation with parameter type checking
Query Paging
Efficient streaming of large result sets with manual or automatic paging
TLS Support
Secure connections with OpenSSL or Rustls
Load Balancing
Configurable policies for optimal request distribution
Retry Policies
Automatic retries with customizable strategies
Metrics & Tracing
Built-in observability for monitoring and debugging
Explore the documentation
Learn how to use the driver’s advanced features
Community and support
Get help and connect with other developers
GitHub Repository
View source code, report issues, and contribute to the project
ScyllaDB Forum
Ask questions and discuss with the ScyllaDB community
ScyllaDB Slack
Join the #rust-driver channel for real-time support
ScyllaDB University
Free course on using the Rust driver with ScyllaDB
Ready to build with ScyllaDB?
Start building high-performance Rust applications with the ScyllaDB driver today
Get Started Now