Custom types for SQLModel/SQLalchemy
Project description
Sql Types
Custom types for SQLModel/SQLalchemy
Usage
from typing import Sequence
from pydantic import BaseModel
from sqlmodel import Field, SQLModel
from sqltypes import PydanticModel, SpaceDelimitedList
class User(BaseModel):
name: str
age: int
class MyDBItem(SQLModel, table=True):
id: int | None = Field(default=None, primary_key=True)
tags: Sequence[str] = Field(sa_type=SpaceDelimitedList)
user: User = Field(sa_type=PydanticModel(User))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sqltypes-0.1.1.tar.gz
(2.6 kB
view hashes)