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.4.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.4-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqltypes-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 b3d03f3b47bafe54c648ab6f14fe3f365d1f08e0db60cde44083b0f510356608
MD5 42463b93d27087a3ecb0cce1503012db
BLAKE2b-256 6b422aa7c053ca61469bc2de0dbabe98e8e4b1a7de734b45bea5d285c5cb2e03

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqltypes-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9e7694ba1450d8a3722e41b6245cd228d8a953430139f8d92011f35d571aab9d
MD5 a59854404506a709fecce915feb63ea9
BLAKE2b-256 3ac26aab1e1a1508f0b7950075089499070da0b786e4eaa4536eb63a9c073f2e

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