Skip to main content

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


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.3.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqltypes-0.1.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file sqltypes-0.1.3.tar.gz.

File metadata

  • Download URL: sqltypes-0.1.3.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for sqltypes-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7fb1a5bfbcef371bfd906fe568b6a387c01dcae132a8bda9b5dfd04a1580f006
MD5 7f6922024f9df04fa76e7feb511168d4
BLAKE2b-256 75b87017d528225e3ef07673662e193ba5686fe6acad1975d128d65fa934538a

See more details on using hashes here.

File details

Details for the file sqltypes-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: sqltypes-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for sqltypes-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 469fa0602dc38bc0d77a53fb9e89764766947a44aedca35b059967adc8017c7d
MD5 904a64aa89d37733d77b6583a9e0b3a5
BLAKE2b-256 b84e8df10f4644983119fce32fcedf07790a52b50ad32c80c4d54f63daad3470

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page