A terminal-based SQLite database browser with AI-powered natural language query generation using AWS Bedrock.
- SQLite Database Browser - View tables, browse data, and inspect rows
- AI-Powered Queries - Ask questions in plain English, get SQL automatically
- Dual Mode - Switch between AI mode and direct SQL mode
- Safe Modifications - Confirmation required before committing data changes (UPDATE/DELETE/INSERT)
- Professional Dark Theme - Eye-friendly terminal UI
- Keyboard Navigation - Full keyboard support with intuitive bindings
- Python 3.8+
- uv (Python package manager)
- AWS Account with Bedrock access
-
Clone or download the project
cd /path/to/dbui -
Install dependencies
uv sync
-
Configure AWS Bedrock API Key
a. Visit the AWS Bedrock API Keys page:
https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/api-keys?tab=short-termb. Click "Generate API Key" to create a short-term key
c. Copy the generated bearer token
d. Create a
.envfile in the project root:touch .env
e. Add your API key to
.env:AWS_BEARER_TOKEN_BEDROCK=bedrock-api-key-YOUR_TOKEN_HERE
Important: Never commit your
.envfile to git! -
Verify
.gitignoreincludes.envecho ".env" >> .gitignore
uv run app.py /path/to/your/database.dbExample:
uv run app.py ./example.db- Press
tto switch to AI Mode (? icon) - Type your question in plain English:
- "Show me all users from California"
- "Count total orders by month"
- "Find products with low stock"
- Press Enter - the AI generates and executes SQL automatically
- Press
tto switch to SQL Mode (=? icon) - Type raw SQL queries:
SELECT * FROM users WHERE state = 'CA'
- Press Enter to execute
When using UPDATE, DELETE, or INSERT queries (especially in AI mode):
- Query executes but does NOT commit immediately
- Shows number of rows affected
- Prompts: "Press 'y' to commit or 'n' to cancel"
- Press
yto save changes permanently - Press
nto rollback (no changes made)
| Key | Action |
|---|---|
Tab |
Switch between table and input field |
t |
Toggle between AI Mode and SQL Mode |
b |
Go back to table list (when viewing table data) |
y |
Confirm data changes (when prompted) |
n |
Cancel data changes (when prompted) |
q |
Quit application |
- Ask questions in natural language
- AI converts to SQL automatically
- Shows generated SQL query
- Confirms before modifying data
- Write SQL queries directly
- Full SQLite syntax support
- Immediate execution (SELECT queries)
- Confirms before modifying data
-- See table structure
PRAGMA table_info(table_name);
-- See CREATE statement
SELECT sql FROM sqlite_master WHERE name = 'table_name';- SELECT queries display formatted JSON results
- UPDATE/DELETE/INSERT show affected row counts
- Schema queries show formatted CREATE statements
- Scrollable panels for large result sets
- SQL syntax errors displayed in left panel
- AI initialization failures show clear error messages
- Connection issues handled gracefully
Solution: Check your .env file has the correct AWS_BEARER_TOKEN_BEDROCK value
Causes:
- Expired API key (short-term keys expire after ~12 hours)
- Invalid bearer token
- No internet connection
- AWS Bedrock not available in your region
Solution: Generate a new API key from the AWS Console
Cause: AI couldn't determine what SQL query to generate
Solution: Be more specific, e.g.:
- L "update the user"
- � "update user with id 5 to have state DE"
Cause: Invalid database path or file not found
Solution: Ensure you provide an absolute path to a .db file:
uv run app.py /absolute/path/to/database.db?� Important Security Practices:
-
Never commit
.envto version control- Add
.envto.gitignore - Use
.env.examplefor templates
- Add
-
Short-term API keys expire
- AWS Bedrock short-term keys typically expire after 12 hours
- Regenerate as needed
-
Database backups
- Always backup your database before using UPDATE/DELETE
- Test queries on a copy first
-
SQL injection awareness
- The AI generates SQL from your natural language
- Review generated SQL before confirming data modifications
This is a personal project. Feel free to fork and modify for your own use.
See project license file.
- Built with Textual - TUI framework
- Powered by AWS Bedrock - AI/LLM service
- Uses Amazon Nova Lite model for SQL generation