Metadata-Version: 2.4
Name: pyntegritydb
Version: 0.1.0
Summary: Una biblioteca para medir la calidad de la integridad referencial en bases de datos relacionales.
Author-email: Osvaldo Trujillo <osvaldo.trujillo.ingenieria@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Osvaldo Trujillo
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/osvaldomx/pyntegritydb
Project-URL: Repository, https://github.com/osvaldomx/pyntegritydb
Project-URL: Changelog, https://github.com/osvaldomx/pyntegritydb/releases/tag/v0.2.0
Project-URL: Issues, https://github.com/osvaldomx/pyntegritydb/issues
Keywords: database,integrity,data quality,sql,validator
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: psycopg2-binary==2.9.10
Requires-Dist: sqlalchemy>=2.0
Requires-Dist: networkx>=3.0
Requires-Dist: pandas>=2.0
Requires-Dist: tabulate>=0.9
Requires-Dist: PyYAML>=6.0
Requires-Dist: matplotlib>=3.7
Provides-Extra: dev
Requires-Dist: pytest==8.4.1; extra == "dev"
Requires-Dist: mock==5.2.0; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Dynamic: license-file

# pyntegritydb

[![PyPI version](https://badge.fury.io/py/pyntegritydb.svg)](https://badge.fury.io/py/pyntegritydb)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python versions](https://img.shields.io/pypi/pyversions/pyntegritydb)](https://pypi.org/project/pyntegritydb/)
[![Build Status](https://github.com/tu_usuario/pyntegritydb/actions/workflows/ci.yml/badge.svg)](https://github.com/osvaldomx/pyntegritydb/actions)


**pyntegritydb** es una herramienta de línea de comandos para analizar y medir la calidad de la integridad referencial en bases de datos relacionales. Basada en el paper académico ["Referential Integrity Quality Metrics"](https://www2.cs.uh.edu/~ordonez/pdfwww/w-2008-DSS-refint.pdf), la biblioteca te ayuda a diagnosticar rápidamente relaciones rotas o "huérfanas" en tu esquema.



---
## Características Principales

* **Análisis Basado en Métricas**: Calcula métricas clave como `validity_rate` y `orphan_rate` para cada relación.
* **Soporte Multi-DB**: Compatible con cualquier base de datos que soporte SQLAlchemy (PostgreSQL, MySQL, SQLite, etc.).
* **Reportes Flexibles**: Genera reportes en múltiples formatos: tabla para la consola (`cli`), `json` o `csv`.
* **Visualización de Esquema**: Crea un grafo visual de las relaciones de tu base de datos, coloreando las conexiones según su "salud".
* **Fácil de Usar**: Diseñada como una herramienta de línea de comandos simple y directa.

---
## Instalación

Instala `pyntegritydb` directamente desde PyPI:

```bash
pip install pyntegritydb
```

---
## Guía de Inicio Rápido

Puedes analizar tu base de datos con un único comando, pasándole la URI de conexión de SQLAlchemy.

### 1. Ejecutar un Análisis Básico

El siguiente comando se conectará a una base de datos SQLite y mostrará un reporte en la consola.

```bash
pyntegritydb "sqlite:///ruta/a/tu/database.db"
```

### 2. Generar Reporte en JSON

Usa el argumento `--format` para cambiar el formato de salida.

```bash
pyntegritydb "postgresql://user:pass@host/db" --format json
```

### 3. Generar una Visualización del Grafo

Próximamente se añadirá la funcionalidad para generar y guardar el grafo visual directamente desde la CLI.

---
## Desarrollo

Si quieres contribuir al proyecto, sigue estos pasos:

1.  **Clona el repositorio:**
    ```bash
    git clone [https://github.com/tu_usuario/pyntegritydb.git](https://github.com/tu_usuario/pyntegritydb.git)
    cd pyntegritydb
    ```

2.  **Crea y activa un entorno virtual:**
    ```bash
    python3 -m venv venv
    source venv/bin/activate
    ```

3.  **Instala las dependencias en modo editable:**
    ```bash
    pip install -e ".[dev]" 
    # (Necesitarás definir los 'dev' extras en pyproject.toml para pytest, etc.)
    ```
4.  **Ejecuta las pruebas:**
    ```bash
    pytest
    ```

---
## Licencia

Este proyecto está bajo la Licencia MIT. Consulta el archivo `LICENSE` para más detalles.
