aws_utils_athena
A Rust client library for AWS Athena, providing convenient utilities for query execution and result streaming.
Features
- Simple client creation with configurable timeouts
- Query execution with support for all Athena parameters
- Asynchronous query execution with wait functionality
- Stream-based result retrieval for large datasets
- Comprehensive error handling
Installation
Add this to your Cargo.toml
:
[]
= "0.1.0"
Usage
Creating a Client
use aws_utils_athena;
// Create client with default timeouts
let client = make_client_with_timeout_default.await;
// Create client with custom timeouts
use Duration;
let client = make_client_with_timeout.await;
Executing Queries
use query;
use ;
// Start query execution
let result = start_query_execution.await?;
// Get query execution status
let execution_id = result.query_execution_id;
let status = get_query_execution.await?;
Waiting for Query Completion
use wait;
use Duration;
// Execute query and wait for completion
let builder = client.start_query_execution
.query_string
.query_execution_context;
let query_execution_id = start_query_execution_wait.await?;
Streaming Query Results
use query;
use TryStreamExt;
// Get results as a stream
let stream = get_query_results_stream;
// Process results
pin_mut!;
while let Some = stream.try_next.await?
Error Handling
The library provides a comprehensive Error
enum for handling various failure cases:
use Error;
match start_query_execution.await
Authentication
The client uses the AWS SDK's default credential chain for authentication:
- Environment variables (
AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
,AWS_REGION
) - ECS task role (for Fargate/ECS)
- EC2 instance profile
- AWS credentials file
- Other configured credential providers
License
This project is part of the utilities.aws-utils workspace.