Skip to main content

etlantic-sqlmodel

Optional bridge between ETLantic Data contracts and SQLModel table models, plus optional CP1 control-plane reference stores. Install when you need contract_to_sqlmodel helpers or SQLModel-backed definition/submission stores for local CP1 demos. Package version is 0.59.0 — pin with core.

Install

pip install 'etlantic-sqlmodel==0.59.0'
# pip install 'etlantic==0.59.0'

For managed headless services, use the root extra. It installs SQLModel and the supported PostgreSQL driver without FastAPI:

pip install 'etlantic[managed-headless]>=0.59.0'

The HTTP adapter retains its separate etlantic-fastapi[managed] extra.

Schema bridge

from etlantic import Data
from etlantic_sqlmodel import contract_to_sqlmodel, compare_metadata


class Customer(Data):
    customer_id: int
    name: str


CustomerTable = contract_to_sqlmodel(
    Customer,
    table_name="customer",
    primary_key=("customer_id",),
)
assert compare_metadata(Customer, CustomerTable).valid

Control-plane reference stores (CP1/CP2)

Request-scoped sessions and SQLModel-backed DefinitionRepository / SubmissionStore / CP2 RegistryProvider implementations. Persistence models are separate from HTTP response models. create_control_plane_tables and create_registry_tables are for tests and local demos only — production must apply versioned migrations via etlantic_sqlmodel.migrations (do not use create_all as the sole schema path).

from etlantic_sqlmodel.control_plane import (
    SQLModelDefinitionRepository,
    SQLModelSubmissionStore,
    SqlModelRegistryProvider,
    create_sqlite_engine,
)
from etlantic_sqlmodel.migrations import apply_migrations

engine = create_sqlite_engine("sqlite:///cp.db")
apply_migrations(engine)  # all provider-owned CP1–CP4 tables
registry = SqlModelRegistryProvider(engine)
definitions = SQLModelDefinitionRepository(engine)
submissions = SQLModelSubmissionStore(engine)

Registry conformance (memory vs SQLModel promote/suspend):

uv run python scripts/check_registry_conformance.py --fake

These stores honor scoped idempotency and survive process restart when backed by a durable database URL. For CP-GA Supported profiles, treat snapshots as canonical for backup/restore; entity dual-write rows are denormalized mirrors for isolation queries. Use separate engines/schemas per tenant for isolated-deployment / dedicated-schema.

Managed backend and schema inspection (0.57.0)

create_managed_backend builds the authorized service graph without importing FastAPI or requiring an HTTP context factory. The factory owns an engine it creates; an injected engine remains caller-owned. Both paths require explicit migrations and perform read-only compatibility inspection before returning.

from etlantic_sqlmodel import SQLModelBackendConfig, create_managed_backend

backend = create_managed_backend(
    SQLModelBackendConfig(
        database_url=database_url,
        store_id="control-plane",
        profile=profile,
    ),
    authorizer=authorizer,
)

# The context must come from the consumer's trusted identity boundary.
schedule = backend.schedule_service
worker = backend.create_execution_host(owner_id="etl-worker-1")
action_worker = backend.create_action_execution_host(worker_id="actions-1")
scheduler = backend.create_scheduler(owner_id="scheduler-1")

Each role exposes status(), request_drain(), and a ready() convenience method. Run blocking ticks on consumer-owned threads. After requesting drain, join those threads before calling backend.close(); close refuses to dispose an owned engine while a role tick remains active. Optional adapter roles should register their shared lifecycle with backend.register_runtime_role(role); PrefectDispatcher registers automatically. This keeps backend shutdown from disposing shared stores during an adapter tick. The schedule service owns command authorization and trigger recovery for both headless and HTTP callers.

schema_requirements() publishes required managed-store tables, columns, primary keys, and unique keys. inspect_schema(engine) returns one of fresh, behind, compatible, unknown_or_ahead, partial_or_corrupt, or unreachable, with redacted reason codes. It does not create or upgrade schema objects. Apply etlantic_sqlmodel.migrations.upgrade(engine) as an explicit deployment step.

Optional packages · Source · Issues

Metadata

Release files for etlantic-sqlmodel 0.59.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for etlantic-sqlmodel 0.59.0
File Size Uploaded
etlantic_sqlmodel-0.59.0.tar.gz 59.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for etlantic-sqlmodel 0.59.0
File Interpreter ABI Platform
etlantic_sqlmodel-0.59.0-py3-none-any.whl Python 3 none any Details

Total release size: 138.1 kB

Release files / etlantic_sqlmodel-0.59.0.tar.gz

Download URL etlantic_sqlmodel-0.59.0.tar.gz
Size 59.2 kB
Tags Source
SHA-256 checksum
How to use checksums
23e70dacf509f4f5373d997a2f0e1cb997e0fe911305aea0496a2134cb516cbf
BLAKE2b-256 checksum
How to use checksums
74263d12a64e290dbc141fc773207682cfe4eaa236ba553c865d2445354c42b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / etlantic_sqlmodel-0.59.0-py3-none-any.whl

Download URL etlantic_sqlmodel-0.59.0-py3-none-any.whl
Size 78.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ead4e8d00d509df9bd14f5dcd56286f1c62774f945ec7ba72d5e83ca6d2ca4af
BLAKE2b-256 checksum
How to use checksums
53eec1f03b54e0e358b8553a64841596e4d2de8797a99b70b759501c3c15db4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.59.0 This release

2 release files

0.58.0

2 release files

0.57.2

2 release files

0.57.1

2 release files

0.55.0

2 release files

0.54.0

2 release files

0.53.0

2 release files

0.52.1

2 release files

0.52.0

2 release files

0.51.0

2 release files

0.50.1

2 release files

0.50.0

2 release files

0.48.0

2 release files

0.47.0

2 release files

0.46.0

2 release files

0.45.0

2 release files

0.40.0

2 release files

0.39.0

2 release files

0.38.0

2 release files

0.37.0

2 release files

0.36.0

2 release files

0.35.0

2 release files

0.34.0

2 release files

0.33.0

2 release files

0.32.0

2 release files

0.31.0

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.0

2 release files

0.24.0

2 release files

0.23.0

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.14.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page