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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqltypes-0.1.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for sqltypes-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7efcbf36a5b0a8ae2611eb3131088d7df55ac00367609b216cc28ba3f02fd702
MD5 5626820bb4f4a51f2ddecd8c49502786
BLAKE2b-256 f331413be6d8ef573319423d7d82017a8f395ce938c58a456c545a696d9bb5b8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for sqltypes-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f034fc93ca8bc7fcd2ddab64b6117e0991bd6052e0609322ee2110a5b552732
MD5 9ad805e7806e2ab4b89643087843f4ea
BLAKE2b-256 55d13fb72cff7e0ab6598d919a22b883e8244fbdfec7a32a733a79ca5e7f21eb

See more details on using hashes here.

Supported by

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