Skip to main content

SQLModel / SQLAlchemy DBSession adapter for Causeway.

Project description

causeway-db-sqlmodel

SQLModel / SQLAlchemy DBSession adapter for Causeway. Auto-loads from settings.database_url.

from causeway import register
from causeway_db_sqlmodel import SqlModelSession

register(SqlModelSession(dsn="postgresql+asyncpg://user:pass@host/db"))

Typed JSON columns

Use json_field() when a JSON column has a real Python shape and route code should not deal with dict[str, Any].

from msgspec import Struct
from sqlmodel import SQLModel
from causeway_db_sqlmodel import json_field


class ScreeningSnapshot(Struct):
    score: int
    reasons: list[str]


class Customer(SQLModel, table=True):
    id: int | None = None
    screening: ScreeningSnapshot = json_field(ScreeningSnapshot)

The database still stores JSON/JSONB. Values are converted to built-in JSON types on write and converted back to ScreeningSnapshot on read.

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

causeway_db_sqlmodel-0.6.0.tar.gz (75.1 kB view details)

Uploaded Source

Built Distribution

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

causeway_db_sqlmodel-0.6.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file causeway_db_sqlmodel-0.6.0.tar.gz.

File metadata

  • Download URL: causeway_db_sqlmodel-0.6.0.tar.gz
  • Upload date:
  • Size: 75.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for causeway_db_sqlmodel-0.6.0.tar.gz
Algorithm Hash digest
SHA256 8d0e387b28e93b49118f87e0dc46280f940c0c7f4aa74b8424cde03efd64b78e
MD5 e2a1bed4dfef5d9fd4750933d427b29a
BLAKE2b-256 8f597f443109681e2538952abc294bcde92f108ababef9f569b928d56b836782

See more details on using hashes here.

Provenance

The following attestation bundles were made for causeway_db_sqlmodel-0.6.0.tar.gz:

Publisher: release.yml on tamimbinhakim/causeway

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file causeway_db_sqlmodel-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for causeway_db_sqlmodel-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aee280cc3b101ba282104f1f039ccc556dfeda3ae89a738bffd55afa72e1b26f
MD5 61fb070e87c298c86d451f179cabb2ca
BLAKE2b-256 887427d5cb875818cbd3a8336ab6ea7f0e08c71b037ec4a2c0328d409e3e9c77

See more details on using hashes here.

Provenance

The following attestation bundles were made for causeway_db_sqlmodel-0.6.0-py3-none-any.whl:

Publisher: release.yml on tamimbinhakim/causeway

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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