Metadata-Version: 2.4
Name: tui-db-manager
Version: 0.1.2
Summary: A Textual-based Database Manager
Author: gaurav pandit
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: textual>=0.47.1
Requires-Dist: sqlalchemy>=2.0.25
Requires-Dist: python-dateutil>=2.9.0
Dynamic: license-file

# 🗄️ TUI DB Manager

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)

**TUI DB Manager** is a beautiful, keyboard-first Terminal User Interface (TUI) for managing SQL databases directly from your command line. Built with [Textual](https://textual.textualize.io/) and [SQLAlchemy](https://www.sqlalchemy.org/), it brings GUI-level interactions to the terminal.

---

## ✨ Features

- **Context-Aware Action Menus**: Say goodbye to memorizing hotkeys. Simply click a cell, header, or press `t` to open intelligent, context-aware dropdown menus!
  - 🖱️ **Row Menu:** Edit cells, delete rows, or insert new rows dynamically.
  - 🖱️ **Column Menu:** Rename, add, or drop columns.
  - 🖱️ **Table Menu:** Create, rename, or drop entire tables.
- **Smart Date Parsing**: AI-like fuzzy parsing for `DATE` and `DATETIME` columns. Type `"Jan 1st 2023"` and watch it magically auto-align to `2023-01-01 00:00:00` before saving.
- **Strict Data Validation**: Prevents saving bad data. Instantly catches and warns you if you try to put letters in an `INTEGER` column or malformed booleans in a `BOOLEAN` column.
- **Raw SQL Execution**: A dedicated command box at the bottom allows you to execute raw SQL scripts (`SELECT`, `JOIN`, `CREATE`, etc.) and immediately visualize the output in the data table!
- **Schema Viewer**: Press `s` at any time to seamlessly toggle between viewing your live data and inspecting the underlying database schema constraints.
- **Dark Mode / Light Mode**: Beautiful thematic defaults. Press `d` to toggle.

## 🚀 Installation

Because this tool is packaged as a standard Python library, you can install it globally or within a virtual environment.

### From Source
1. Clone this repository and navigate into it:
   ```bash
   git clone https://github.com/yourusername/tui-db-manager.git
   cd tui-db-manager
   ```
2. Install the package via pip:
   ```bash
   pip install -e .
   ```

## 💻 Usage

Once installed, the application registers a global terminal command. You can launch it from **any directory** on your computer by simply typing:

```bash
tui-db
```

*Note: If no connection string is provided, `tui-db` will automatically search for or create a `sample.db` SQLite database in your current working directory.*

### Default Keybindings
- **`Arrows`**: Navigate the data table
- **`Enter` / `Click`**: Open Context Menus
- **`s`**: Toggle Schema View
- **`t`**: Open Table Actions Menu
- **`d`**: Toggle Dark Mode
- **`q`**: Quit

## 📜 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
