unboil-pydantic-sqlalchemy


Nameunboil-pydantic-sqlalchemy JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryA library to seamlessly integrate SQLAlchemy models with Pydantic.
upload_time2025-08-11 12:43:31
maintainerNone
docs_urlNone
authoreyueldk
requires_python>=3.9
licenseMIT
keywords pydantic sqlalchemy unboil
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Pydantic-Alchemy

A SQLAlchemy type decorator for storing and retrieving Pydantic models in PostgreSQL JSONB columns.
This library enables seamless integration between Pydantic and SQLAlchemy, allowing you to store validated data models directly in your database.

## Features
- Store Pydantic models in PostgreSQL JSONB columns
- Automatic validation and serialization/deserialization
- Works with Alembic migrations

## Installation
```bash
pip install pydantic-alchemy
```

## Usage Example
```python
from pydantic import BaseModel
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
from pydantic_alchemy import PydanticJSONB


class Base(DeclarativeBase):
    pass

class Profile(BaseModel):
    age: int
    bio: str


class User(Base):
    __tablename__ = 'users'
    id: Mapped[int] = mapped_column(primary_key=True)
    profile: Mapped[Profile] = mapped_column(PydanticJSONB(Profile))

# Now, assigning a Profile instance to user.profile will automatically validate and serialize it.
```
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "unboil-pydantic-sqlalchemy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "pydantic, sqlalchemy, unboil",
    "author": "eyueldk",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/31/59/d8da59f5c523fd36d008fef2d381cc1ece17c6c91e15fb7928d3f6b032ed/unboil_pydantic_sqlalchemy-0.1.2.tar.gz",
    "platform": null,
    "description": "\n# Pydantic-Alchemy\n\nA SQLAlchemy type decorator for storing and retrieving Pydantic models in PostgreSQL JSONB columns.\nThis library enables seamless integration between Pydantic and SQLAlchemy, allowing you to store validated data models directly in your database.\n\n## Features\n- Store Pydantic models in PostgreSQL JSONB columns\n- Automatic validation and serialization/deserialization\n- Works with Alembic migrations\n\n## Installation\n```bash\npip install pydantic-alchemy\n```\n\n## Usage Example\n```python\nfrom pydantic import BaseModel\nfrom sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column\nfrom pydantic_alchemy import PydanticJSONB\n\n\nclass Base(DeclarativeBase):\n    pass\n\nclass Profile(BaseModel):\n    age: int\n    bio: str\n\n\nclass User(Base):\n    __tablename__ = 'users'\n    id: Mapped[int] = mapped_column(primary_key=True)\n    profile: Mapped[Profile] = mapped_column(PydanticJSONB(Profile))\n\n# Now, assigning a Profile instance to user.profile will automatically validate and serialize it.\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A library to seamlessly integrate SQLAlchemy models with Pydantic.",
    "version": "0.1.2",
    "project_urls": {
        "homepage": "https://github.com/eyueldk/unboil-pydantic-sqlalchemy",
        "repository": "https://github.com/eyueldk/unboil-pydantic-sqlalchemy"
    },
    "split_keywords": [
        "pydantic",
        " sqlalchemy",
        " unboil"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d1dca8fc21eb057abe9e987bd661619de76aebe929b3f06014e053cc66ade358",
                "md5": "4adc0a100ee409d543f2b513d93c705b",
                "sha256": "36b6a7066fefa6b2d283655ade38281ce187bb000526fc4c40a6f1377ea0b2d4"
            },
            "downloads": -1,
            "filename": "unboil_pydantic_sqlalchemy-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4adc0a100ee409d543f2b513d93c705b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 3189,
            "upload_time": "2025-08-11T12:43:30",
            "upload_time_iso_8601": "2025-08-11T12:43:30.214446Z",
            "url": "https://files.pythonhosted.org/packages/d1/dc/a8fc21eb057abe9e987bd661619de76aebe929b3f06014e053cc66ade358/unboil_pydantic_sqlalchemy-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3159d8da59f5c523fd36d008fef2d381cc1ece17c6c91e15fb7928d3f6b032ed",
                "md5": "6a538a0da4ee7907c325a455f5702b20",
                "sha256": "9b96d90f1c608c5c08138c3c2ad7346e0cfabc0d8f35e570f09ed371006742c0"
            },
            "downloads": -1,
            "filename": "unboil_pydantic_sqlalchemy-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "6a538a0da4ee7907c325a455f5702b20",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 13060,
            "upload_time": "2025-08-11T12:43:31",
            "upload_time_iso_8601": "2025-08-11T12:43:31.315517Z",
            "url": "https://files.pythonhosted.org/packages/31/59/d8da59f5c523fd36d008fef2d381cc1ece17c6c91e15fb7928d3f6b032ed/unboil_pydantic_sqlalchemy-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-11 12:43:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eyueldk",
    "github_project": "unboil-pydantic-sqlalchemy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "unboil-pydantic-sqlalchemy"
}
        
Elapsed time: 0.93798s