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.57.0 — pin with core.
Install
pip install 'etlantic-sqlmodel==0.58.0'
# pip install 'etlantic==0.58.0'
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.
Links
Metadata
Release files for etlantic-sqlmodel 0.58.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| etlantic_sqlmodel-0.58.0.tar.gz | 60.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| etlantic_sqlmodel-0.58.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 138.8 kB
Release files / etlantic_sqlmodel-0.58.0.tar.gz
| Download URL | etlantic_sqlmodel-0.58.0.tar.gz |
|---|---|
| Size | 60.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fce72407f51dafab97ae161219935025cabe629b9e173afa98bfa1288097c34
|
|
BLAKE2b-256 checksum How to use checksums |
7767eeeab91a8864909588809e51d973afb79b1e0f9c683d90b0af5f7e1ae6d1
|
| 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.58.0-py3-none-any.whl
| Download URL | etlantic_sqlmodel-0.58.0-py3-none-any.whl |
|---|---|
| Size | 78.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1d3e0caa4ed7d5b24e364bcfea921021f166fe177b4bfacd2be1be9946a6d91
|
|
BLAKE2b-256 checksum How to use checksums |
2603dac26c46dc665bc64ddad2855d6fe9a14c947efb0b33c0993a9c2dd59998
|
| 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}
|