Metadata-Version: 2.4
Name: dbsync-py
Version: 1.0.0.dev7
Summary: Python helper package for interacting with Cardano DB Sync databases
Project-URL: Homepage, https://github.com/TheElderMillenial/dbsync-py
Project-URL: Bug Reports, https://github.com/TheElderMillenial/dbsync-py/issues
Project-URL: Source, https://github.com/TheElderMillenial/dbsync-py
Project-URL: Documentation, https://TheElderMillenial.github.io/dbsync-py/
Author-email: TheElderMillenial <eldermillenial@protonmail.com>
License: Apache-2.0
License-File: LICENSE
Keywords: blockchain,cardano,database,orm,postgresql,sqlalchemy
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Database :: Database Engines/Servers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Requires-Dist: click>=8.2.1
Requires-Dist: psycopg[binary,pool]>=3.1.0
Requires-Dist: pycardano>=0.10.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: sqlmodel>=0.0.14
Provides-Extra: async
Requires-Dist: asyncpg>=0.28.0; extra == 'async'
Requires-Dist: greenlet>=2.0.0; extra == 'async'
Provides-Extra: dev
Requires-Dist: bandit>=1.7.0; extra == 'dev'
Requires-Dist: build>=0.10.0; extra == 'dev'
Requires-Dist: coverage[toml]>=7.0.0; extra == 'dev'
Requires-Dist: mypy>=1.5.0; extra == 'dev'
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-benchmark>=4.0.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest-xdist>=3.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.0.280; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-gen-files>=0.5.0; extra == 'docs'
Requires-Dist: mkdocs-material>=9.0.0; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.22.0; extra == 'docs'
Requires-Dist: pymdown-extensions>=10.0.0; extra == 'docs'
Description-Content-Type: text/markdown

# dbsync-py

[![Test Suite](https://github.com/TheElderMillenial/dbsync-py/actions/workflows/test.yml/badge.svg)](https://github.com/TheElderMillenial/dbsync-py/actions/workflows/test.yml)
[![Documentation](https://github.com/TheElderMillenial/dbsync-py/actions/workflows/docs.yml/badge.svg)](https://github.com/TheElderMillenial/dbsync-py/actions/workflows/docs.yml)
[![PyPI version](https://badge.fury.io/py/dbsync-py.svg)](https://badge.fury.io/py/dbsync-py)
[![Python Support](https://img.shields.io/pypi/pyversions/dbsync-py.svg)](https://pypi.org/project/dbsync-py/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Python helper package for interacting with Cardano DB Sync databases.

This package provides SQLModel-based ORM models and utilities for interacting with Cardano DB Sync PostgreSQL databases, enabling type-safe access to Cardano blockchain data.

## Installation

```bash
pip install dbsync-py
```

## Configuration

dbsync-py supports multiple ways to configure database connections:

### Option 1: Environment File (.env)

Copy `sample.env` to `.env` and modify the values:

```bash
cp sample.env .env
# Edit .env with your database configuration
```

### Option 2: Environment Variables

Set environment variables directly:

```bash
export DBSYNC_HOST=localhost
export DBSYNC_PORT=5432
export DBSYNC_DATABASE=cexplorer
export DBSYNC_USERNAME=your_username
export DBSYNC_PASSWORD=your_password
```

### Option 3: Complete Database URL

```bash
export DBSYNC_DATABASE_URL=postgresql://username:password@localhost:5432/cexplorer
```

## Quick Start

```python
import dbsync_py

# Test database connection
from dbsync_py.utils import quick_connection_check
if quick_connection_check():
    print("✅ Database connection successful!")
else:
    print("❌ Database connection failed")

# Use database sessions
from dbsync_py.session import get_session_context
with get_session_context() as session:
    result = session.execute("SELECT version()")
    print(result.scalar())
```

## Development Status

This project is currently in development. Core database connection utilities are implemented.

## License

Apache-2.0
