Vapor CLI
Vapor CLI is a powerful, interactive command-line interface for SQLite databases. It's designed to be a lightweight, fast, and user-friendly tool for developers, data analysts, and anyone who works with SQLite. Vapor CLI combines the power of a direct SQL interface with the convenience of a modern shell and data management utilities.
Features
- Interactive SQL REPL: A robust Read-Eval-Print Loop for executing SQL queries, with multi-line input, command history, and auto-completion.
- Interactive Shell: A built-in shell for navigating the filesystem, running system commands, and managing your database environment without leaving the tool.
- Direct SQL Execution: Run SQL queries directly from your terminal for quick, one-off tasks.
- CSV Import/Export: Seamlessly import data from CSV files into tables or export query results to CSV.
- Database Population: Generate large volumes of synthetic data with configurable schemas, data types, and distributions for testing and development.
- Query Bookmarks: Save, manage, and reuse your frequently used SQL queries with a powerful bookmarking system.
- Multiple Output Formats: Display query results in different formats, including formatted tables, JSON, and CSV.
- Explicit Transaction Management: Manually control database transactions (
BEGIN,COMMIT,ROLLBACK) within the REPL.
Installation
-
Clone the repository:
-
Build the project using Cargo:
The executable will be located at
target/release/vapor-cli. -
(Optional) Install it locally:
To make
vapor-cliavailable from anywhere in your system, you can install it using Cargo:
Usage
Initialize a Database
Create a new, empty SQLite database file.
Connect to a Database
Check the connection to an existing database file.
Interactive SQL REPL
Start an interactive SQL Read-Eval-Print Loop to run queries against a database.
Inside the REPL, you can type SQL statements or use special dot-commands:
-- Select all users
SELECT * FROM users;
-- Special commands
.tables
.schema users
.exit
Interactive Shell
Start an interactive shell session with the database context loaded.
From the shell, you can run system commands or switch back to the REPL:
# List files
# Switch back to the REPL
Manage Tables
Create a new table:
List all tables in the database:
Populate Database
Populate the database with a large amount of sample data for testing purposes.
Configuration
Vapor CLI stores its configuration and history in ~/.config/vapor/.
Configuration
The tool automatically creates and manages:
- Command history in
.vapor_history - Bookmarks in
~/.vapor_bookmarks.json - Database files with
.dbextension
Error Handling
The tool provides detailed error messages and suggestions for common issues:
- Database access problems
- SQL syntax errors
- File system issues
- Resource constraints
Requirements
- Rust 1.70 or later
- SQLite 3
- Sufficient disk space for database operations