athena-cli 0.3.0

A command-line interface for AWS Athena with interactive query execution and result management
Documentation
# AWS Athena CLI
[![Build status](https://github.com/Andyhoang/athena-cli/workflows/CI/badge.svg)](https://github.com/Andyhoang/athena-cli/actions)
[![Crates.io](https://img.shields.io/crates/v/athena-cli.svg)](https://crates.io/crates/athena-cli)
[![Packaging status](https://repology.org/badge/tiny-repos/athena-cli.svg)](https://repology.org/project/athena-cli/badges)
[![Crates.io](https://img.shields.io/crates/d/athena-cli.svg)](https://crates.io/crates/athena-cli)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A command-line interface tool written in Rust for interacting with AWS Athena, providing a streamlined experience similar to the Athena web console.

<img src="athena-cli.gif" alt="Athena CLI Demo" width="600" />

## Purpose

- Execute SQL queries against AWS Athena databases
- List and manage workgroups
- View query history and results
- Manage databases and tables
- Save frequently used queries

## Installation

1. Ensure you have Rust installed (1.70 or later)
2. Clone this repository
3. Run `cargo install --path .`
4. Copy `config.example.toml` to `~/.config/athena-cli/config.toml` and update with your settings

## Usage

### Basic commands:
- `athena-cli query "SELECT * FROM table"` - Execute a query
- `athena-cli database list` - List available databases
- `athena-cli table list` - List tables in a database
- `athena-cli table describe <table-name>` - Describe table structure
- `athena-cli workgroup list` - List available workgroups
- `athena-cli history` - Show recent queries
- `athena-cli inspect <query-id>` - Show detailed information about a query
- `athena-cli inspect <query-id> -o <path>` - Inspect query and download results
- `athena-cli download <query-id>` - Download query results (shortcut for inspect with download)

### Configuration
For configuration, edit `~/.config/aws-athena-cli/config.toml` to set:
- Default workgroup
- Output location
- AWS credentials (if not using AWS CLI configuration)

## Requirements

- AWS account with Athena access
- Configured AWS credentials
- Rust 1.70+

For detailed documentation and examples, see the [Wiki](link-to-wiki).

## Milestones

### Completed ✅
- [x] Authorize athena with SSO profile and ENV variables
- [x] Basic query execution with AWS Athena
- [x] Configuration management with TOML config file
- [x] Query result caching and reuse
- [x] Polars integration for DataFrame handling
- [x] Get detail a history query
- [x] Database schema exploration

### Coming Soon 🚀
- [ ] Custom output formatting
- [ ] Export results to various formats
- [ ] Query history tracking
- [ ] Test cases

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

### Development Setup

1. Clone the repository
2. Install pre-commit hooks to ensure code quality:
   ```bash
   pip install pre-commit
   pre-commit install
   ```

The pre-commit hooks will automatically:
- Format your code with `cargo fmt`
- Run `cargo check` to ensure compilation
- Fix common issues with `cargo clippy --fix`
- Check for other issues like trailing whitespace, YAML/TOML format, etc.