Metadata-Version: 2.4
Name: py_auto_migrate
Version: 0.6
Summary: A Powerful Database Migration Tool To Transfer Data.
Author: Kasra Khaksar
Author-email: kasrakhaksar17@gmail.com
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: openai
Requires-Dist: requests
Requires-Dist: pymysql
Requires-Dist: pymongo
Requires-Dist: click
Requires-Dist: pyodbc
Requires-Dist: psycopg2
Requires-Dist: oracledb
Requires-Dist: redis
Requires-Dist: boto3
Requires-Dist: elasticsearch
Requires-Dist: clickhouse_driver
Requires-Dist: uvicorn
Requires-Dist: fastapi
Requires-Dist: python-multipart
Requires-Dist: jinja2
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

<h1 align="center">
  <strong>Py-Auto-Migrate</strong>
</h1>

<p align="center">
  <em>The Universal Database Migration Tool</em> <br>
  <strong>Seamlessly transfer data between any database.
</p>

<p align="center">
  <a href="https://pypi.org/project/py-auto-migrate/">
    <img src="https://img.shields.io/badge/dynamic/json?url=https://pypi.org/pypi/py-auto-migrate/json&query=info.version&label=PyPI&logo=pypi&style=for-the-badge&logoColor=white&color=blue" alt="PyPI - Version">
  </a>

  <a href="https://github.com/kasrakhaksar/py-auto-migrate">
    <img src="https://img.shields.io/badge/dynamic/json?url=https://api.github.com/repos/kasrakhaksar/py-auto-migrate&query=name&label=GitHub&logo=github&style=for-the-badge&color=181717" alt="GitHub Repo">
  </a>

  <a href="https://github.com/kasrakhaksar/py-auto-migrate/stargazers">
    <img src="https://img.shields.io/badge/dynamic/json?url=https://api.github.com/repos/kasrakhaksar/py-auto-migrate&query=stargazers_count&label=Stars&logo=github&style=for-the-badge&color=yellow" alt="Stars">
  </a>

  <a href="https://github.com/kasrakhaksar/py-auto-migrate/blob/main/LICENSE">
    <img src="https://img.shields.io/badge/License-Apache--2.0-brightgreen?style=for-the-badge" alt="License">
  </a>

  <a href="https://github.com/kasrakhaksar/py-auto-migrate/releases">
    <img src="https://img.shields.io/badge/dynamic/json?url=https://api.github.com/repos/kasrakhaksar/py-auto-migrate/releases/latest&query=tag_name&label=Release&style=for-the-badge" alt="Latest Release">
  </a>
</p>

---

## Why Py-Auto-Migrate?

Migrating data between different database systems is often a tedious and error-prone task. **Py-Auto-Migrate** is here to change that. It's a powerful, flexible, and easy-to-use Python tool that automates the entire process.

-   **Universal Connector**: Supports a vast range of databases, from SQL to NoSQL.
-   **Zero Configuration**: Point to your source and target, and let the tool handle schema detection, data type mapping, and destination creation.
-   **Blazing Fast**: Optimized for performance, even with large datasets.
-   **Safe & Reliable**: Built-in checks ensure data integrity throughout the migration.


---

## Installation

Get started in seconds with `pip`.

```bash
pip install py-auto-migrate
```

### Prefer a Standalone Shell?

Don't have Python? No problem! Download the dedicated **PAM-Shell** for your OS from the [Releases page](https://github.com/kasrakhaksar/py-auto-migrate/releases). It's a ready-to-run executable with the same powerful features.

---

## Quick Start

Using Py-Auto-Migrate is as simple as running one command.

### Basic Command Structure

```bash
py-auto-migrate migrate --source <SOURCE_URI> --target <TARGET_URI>
```

| Argument       | Description                                                                                  |
| -------------- | -------------------------------------------------------------------------------------------- |
| `--source`     | **Required.** Connection URI for the source database.                                        |
| `--target`     | **Required.** Connection URI for the target database.                                        |
| `--table`      | **Optional.** Migrate a specific table. If omitted, **all** data is migrated.                |
| `--ai-ask`     | **Optional.** Natural language query for **AI-powered**.                                     |
| `--ai-model`   | **Optional.** OpenAI model (default: gpt-3.5-turbo).                                         |

### Examples

**1. Migrate an entire database from MongoDB to MySQL:**

```bash
py-auto-migrate migrate \
  --source "mongodb://user:pass@localhost:27017/source_db" \
  --target "mysql://user:pass@localhost:3306/target_db"
```

**2. Migrate a single PostgreSQL table to a new MongoDB collection:**

```bash
py-auto-migrate migrate \
  --source "postgresql://user:pass@localhost:5432/mydb" \
  --target "mongodb://user:pass@localhost:27017/mydb" \ --table users
```

> **The Magic:** If the target database or table doesn't exist, **Py-Auto-Migrate automatically creates it for you!** It intelligently maps source data types to the appropriate target schema.


**3. Query using AI (Target must be a relational database):**

```bash
export OPENAI_API_KEY="your-api-key"
```

> Before using AI, make sure the **OPENAI_API_KEY** has been exported.


```bash
py-auto-migrate migrate \
  --source "oracle://user:password@host:port/service_name" \
  --target "mssql://user:password@host:port/database" \ 
  --ai-ask "Please select and insert only names that start with 'S', then sort them." /
  --ai-model "gpt-3.5-turbo"
```

---

## Dashboard

For an even easier and more visual migration experience, Py-Auto-Migrate includes a dedicated web dashboard.


**Usage:**

```bash
py-auto-migrate dashboard
```

**Default Dashboard URL:**

```bash
http://localhost:8123
```


or :

```bash
py-auto-migrate dashboard --host "localhost" --port 8000
```


**Features:**

- **Visual Interface** – No need to memorize commands or URIs  
- **Connection Builder** – Easily build source/target URIs with form inputs  
- **Table Selection** – Choose specific tables or migrate all with checkboxes  
- **Real-time Logs** – Watch migration progress and errors live  
- **AI Query UI** – Use natural language queries with a simple text box  
- **Job Management** – Run, monitor, and manage multiple migration jobs  
- **One-Click Migrate** – Start migrations with a single button click  

---



## Supported Databases

We support a wide and growing range of databases.

| Category       | Databases                                                                                                                                                                                                                                                                                                                                                                                          |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Relational** | [![MySQL](https://img.shields.io/badge/MySQL-4479A1?style=flat-square&logo=mysql&logoColor=white)](https://www.mysql.com/) [![PostgreSQL](https://img.shields.io/badge/PostgreSQL-4169E1?style=flat-square&logo=postgresql&logoColor=white)](https://www.postgresql.org/) [![Oracle](https://img.shields.io/badge/Oracle-F80000?style=flat-square&logo=oracle&logoColor=white)](https://www.oracle.com/database/) [![SQL Server](https://img.shields.io/badge/SQL%20Server-CC2927?style=flat-square&logo=microsoftsqlserver&logoColor=white)](https://www.microsoft.com/en-us/sql-server) [![MariaDB](https://img.shields.io/badge/MariaDB-003545?style=flat-square&logo=mariadb&logoColor=white)](https://mariadb.org/) [![SQLite](https://img.shields.io/badge/SQLite-003B57?style=flat-square&logo=sqlite&logoColor=white)](https://www.sqlite.org/) |
| **NoSQL**      | [![MongoDB](https://img.shields.io/badge/MongoDB-47A248?style=flat-square&logo=mongodb&logoColor=white)](https://www.mongodb.com/) [![Redis](https://img.shields.io/badge/Redis-DC382D?style=flat-square&logo=redis&logoColor=white)](https://redis.io/) [![DynamoDB](https://img.shields.io/badge/DynamoDB-4053D6?style=flat-square&logo=amazondynamodb&logoColor=white)](https://aws.amazon.com/dynamodb/) [![Elasticsearch](https://img.shields.io/badge/Elasticsearch-005571?style=flat-square&logo=elasticsearch&logoColor=white)](https://www.elastic.co/elasticsearch/) |
| **Analysis**      | [![ClickHouse](https://img.shields.io/badge/ClickHouse-FFCC00?style=flat-square&logo=clickhouse&logoColor=black)](https://clickhouse.com/)                                                                                     |

---

Have a feature request? [Open an issue](https://github.com/kasrakhaksar/py-auto-migrate/issues) and let us know!
