Metadata-Version: 2.4
Name: dbseed
Version: 0.1.0
Summary: Auto-generate fake data for SQLAlchemy models — zero config
License: MIT
Project-URL: Repository, https://github.com/shahabRDZ/dbseed
Keywords: sqlalchemy,seed,fake-data,testing,database,factory
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sqlalchemy>=2.0
Dynamic: license-file

<h1 align="center">dbseed</h1>

<p align="center">
  <strong>Auto-generate fake data for SQLAlchemy models — zero config</strong>
</p>

<p align="center">
  <img src="https://img.shields.io/badge/python-3.10+-blue?logo=python&logoColor=white" />
  <img src="https://img.shields.io/badge/SQLAlchemy-2.0-red?logo=python" />
  <img src="https://img.shields.io/badge/dependencies-zero_(extra)-brightgreen" />
  <img src="https://img.shields.io/badge/license-MIT-green" />
</p>

---

## The Problem

Every project needs test data. You either write tedious factory code or install heavy libraries like Faker. For most cases, you just want 100 rows of realistic-looking data.

## The Solution

```bash
pip install dbseed
```

```python
from dbseed import seed

users = seed(User, SeedConfig(count=100))
session.add_all(users)
await session.commit()
# Done. 100 users with realistic names, emails, ages.
```

dbseed inspects your SQLAlchemy model and **automatically** generates the right kind of data for each column.

## Smart Field Detection

| Column name contains | Generated data |
|---------------------|---------------|
| `email` | `kzmpqwer@example.com` |
| `name` | `Alice Johnson` |
| `password`, `hash` | Random 64-char string |
| `description`, `bio` | Lorem ipsum text |
| `url`, `link` | `https://example.com/word` |
| `phone` | `+12345678901` |
| `String` type | Random alphanumeric |
| `Integer` type | Random 0-10000 |
| `Float` type | Random 0.0-10000.0 |
| `Boolean` type | Random True/False |
| `DateTime` type | Random date within last 30 days |

## Override Specific Fields

```python
from dbseed import seed, SeedConfig

users = seed(User, SeedConfig(
    count=50,
    overrides={
        "role": "admin",                    # static value
        "age": lambda: random.randint(18, 65),  # dynamic callable
    },
))
```

## Features

- Inspects SQLAlchemy model columns automatically
- Smart name-based field detection (email, name, url, etc.)
- Type-based fallback for unknown fields
- Field overrides (static values or callables)
- Skips primary keys and server-default columns
- No external dependencies beyond SQLAlchemy
- Works with SQLAlchemy 2.0 mapped columns

## License

MIT
