Skip to content

API — Optional packages

Status: Available in ETLantic 0.41.0. Per-package API pages for first-party optional packages. Install/overview hub: Optional Packages. Core symbols: Python API Reference.

Each package page includes a minimal setup example, a failure-mode table, and mkdocstrings coverage of the public module tree. Package READMEs remain the install and narrative home.

Packages

Quick module stubs (roots)

The directives below keep root-level coverage discoverable from this hub:

etlantic-polars

etlantic_polars

Polars dataframe plugin for ETLantic.

PolarsTransformCompiler

PolarsTransformCompiler()

Compile dtcs.transform-plan/2 kernel+relational IR to Polars.

PolarsDataframePlugin

PolarsDataframePlugin()

Reference Polars dataframe execution plugin.

create_transform_compiler

create_transform_compiler() -> PolarsTransformCompiler

Entry-point factory for etlantic.transform_compilers.

create_plugin

create_plugin() -> PolarsDataframePlugin

Entry-point factory for etlantic.dataframe_plugins.

etlantic-pandas

etlantic_pandas

Pandas dataframe plugin for ETLantic.

PandasDataframePlugin

PandasDataframePlugin()

Reference Pandas dataframe execution plugin (eager-only).

create_plugin

create_plugin() -> PandasDataframePlugin

Entry-point factory for etlantic.dataframe_plugins.

etlantic-sql

etlantic_sql

etlantic-sql — PostgreSQL / SQLite Tier A reference SQL execution plugin.

etlantic-pyspark

etlantic_pyspark

etlantic-pyspark — PySpark reference plugin for ETLantic.

PySparkPlugin

PySparkPlugin()

Reference PySpark region compiler and executor.

LocalSparkProvider

LocalSparkProvider()

In-process SparkSession provider for CI and local development.

create_plugin

create_plugin() -> PySparkPlugin

Entry-point factory for etlantic.spark_plugins.

create_provider

create_provider() -> LocalSparkProvider

Entry-point factory for etlantic.spark_providers.

etlantic-airflow

etlantic_airflow

etlantic-airflow — Airflow reference orchestrator for ETLantic 0.8.

AirflowOrchestratorPlugin

AirflowOrchestratorPlugin()

Compile a PipelinePlan into a deterministic Airflow DAG module.

load_compiled_module

load_compiled_module(path: str | Path) -> ModuleType

Import and return the generated module (exposes dag and plan meta).

load_compiled_pipeline

load_compiled_pipeline(path: str | Path) -> Any

Import a generated DAG module and return its dag object.

Requires apache-airflow installed in the Airflow environment.

create_plugin

create_plugin() -> AirflowOrchestratorPlugin

Entry-point factory for etlantic.orchestrator_plugins.

etlantic-prefect

etlantic_prefect

etlantic-prefect — Prefect ExecutionScheduler for ETLantic 0.16.

PrefectScheduler

PrefectScheduler()

Optional Prefect direct-execution scheduler (local MVP, no deploy/serve).

create_plugin

create_plugin() -> PrefectScheduler

Entry-point factory for etlantic.scheduler_plugins.

etlantic-keyring

etlantic_keyring

etlantic-keyring — OS keyring secret provider for ETLantic.

KeyringSecretProvider

KeyringSecretProvider(*, service: str = 'etlantic')

Resolve secrets from the OS keyring via keyring.get_password.

SecretRef.name is the keyring service; SecretRef.key is the username. When key is value, default, or empty, name is used as the username and the configured default service applies.

create_provider

create_provider(*, service: str = 'etlantic') -> KeyringSecretProvider

Factory for runtime.register_secret_provider(...) / profile bindings.

etlantic-sqlmodel

etlantic_sqlmodel

etlantic-sqlmodel — ContractModel ↔ SQLModel bridge + CP1 reference stores.

AliasRow

Bases: SQLModel

Scoped alias pointing at an immutable revision.

EnvironmentRow

Bases: SQLModel

Deployment / promotion environment directory row.

LogicalIdentityRow

Bases: SQLModel

Stable logical identity preserved across revisions.

PromotionRow

Bases: SQLModel

Immutable promotion record preserving logical_id.

RevisionRow

Bases: SQLModel

Immutable append-only registry revision.

SecurityDomainRow

Bases: SQLModel

Security-domain directory row.

SQLModelDefinitionRepository

SQLModelDefinitionRepository(engine: Engine)

Workspace-scoped definition registry backed by SQLModel.

SqlModelEventStore

SqlModelEventStore(engine: Engine)

Minimal SQLModel-backed EventStore with tenant/workspace isolation.

SqlModelRegistryProvider dataclass

SqlModelRegistryProvider(engine: Engine, tenants: SqlModelTenantDirectory | None = None, workspaces: SqlModelWorkspaceDirectory | None = None, revisions: SqlModelRevisionRegistry | None = None)

SQLModel :class:RegistryProvider with shared suspension checks.

SqlModelRevisionRegistry dataclass

SqlModelRevisionRegistry(engine: Engine, tenants: SqlModelTenantDirectory | None = None, workspaces: SqlModelWorkspaceDirectory | None = None)

Append-only SQLModel revision store with aliases and promotions.

SQLModelSubmissionStore

SQLModelSubmissionStore(engine: Engine)

Durable acceptance store with ADR-016 scoped idempotency and run observation.

SqlModelTenantDirectory dataclass

SqlModelTenantDirectory(engine: Engine)

SQLModel tenant directory with isolation and suspension fail-closed.

SqlModelWorkspaceDirectory dataclass

SqlModelWorkspaceDirectory(engine: Engine, tenants: SqlModelTenantDirectory | None = None)

SQLModel workspace directory keyed by (tenant_id, workspace_id).

TenantRow

Bases: SQLModel

Durable tenant directory row (CP2 / 040-P).

WorkspaceRow

Bases: SQLModel

Durable workspace directory row (tenant-owned).

SqlModelIntegrationPlugin

Schema bridge helpers without ORM sessions or migrations.

create_control_plane_tables

create_control_plane_tables(engine: Engine) -> None

Create CP reference tables.

Intended for tests and local demos — not a production migration path.

create_registry_tables

create_registry_tables(engine: Engine) -> None

Create CP2 registry tables.

Intended for tests and local demos — not a production migration path. Prefer :mod:etlantic_sqlmodel.migrations.

create_sqlite_engine

create_sqlite_engine(url: str = 'sqlite://', **kwargs: Any) -> Engine

Create an engine; use a file URL for restart durability tests.

make_session_factory

make_session_factory(engine: Engine)

Return a zero-arg factory that opens a short-lived Session.

request_scoped_session

request_scoped_session(engine: Engine)

FastAPI-compatible dependency generator for a request-scoped session.

Sessions stay in the API layer — never pass them into pipeline runtimes.

session_scope

session_scope(engine: Engine) -> Iterator[Session]

Yield a session that commits on success and rolls back on error.

apply_migrations

apply_migrations(engine: Engine) -> str | None

Upgrade to the latest migration (SQLite-friendly for tests).

current_version

current_version(engine: Engine) -> str | None

Return the applied migration version, or None on a fresh database.

downgrade

downgrade(engine: Engine, *, target: str | None = None) -> str | None

Roll back migrations down to target (None = empty schema).

upgrade

upgrade(engine: Engine, *, target: str | None = None) -> str | None

Apply pending migrations up to target (default: latest).

contract_to_sqlmodel

contract_to_sqlmodel(contract_cls: type[Data], *, table_name: str | None = None, primary_key: tuple[str, ...] | None = None) -> type[SQLModel]

Generate a SQLModel table class from a Data / ContractModel class.

contract_to_sqlmodel_source

contract_to_sqlmodel_source(contract_cls: type[Data], *, table_name: str | None = None, primary_key: tuple[str, ...] | None = None) -> str

Generate importable SQLModel source for a Data / ContractModel class.

sqlmodel_to_contract

sqlmodel_to_contract(model_cls: type[Any]) -> dict[str, Any]

Extract draft contract metadata from a SQLModel table class.

primary_key_fields

primary_key_fields(model_cls: type[Any]) -> list[str]

Return ordered primary-key column names from a SQLModel table class.

validate_model_primary_keys

validate_model_primary_keys(model_cls: type[Any], *, expected_keys: tuple[str, ...] | list[str] | None = None) -> ValidationReport

Fail closed when a SQLModel table lacks the expected primary key.

compare_metadata

compare_metadata(left: Any, right: Any) -> ValidationReport

Compare contract and SQLModel metadata; return a ValidationReport.

create_plugin

create_plugin() -> SqlModelIntegrationPlugin

Entry-point factory for tooling and conformance helpers.

run_conformance_checks

run_conformance_checks(contract_cls: type[Data], *, table_name: str | None = None, primary_key: tuple[str, ...] | None = None) -> ValidationReport

Round-trip contract → SQLModel → metadata and compare schemas.

etlantic-datafusion

etlantic_datafusion

Experimental DataFusion plugin package (stub; not production-ready in 0.38.0).

create_plugin

create_plugin()

Entry-point factory for etlantic.dataframe_plugins (experimental stub).

create_transform_compiler

create_transform_compiler()

Entry-point factory for etlantic.transform_compilers (experimental stub).

etlantic-s3

etlantic_s3

Experimental S3-compatible connector package for ETLantic.

S3SinkConnector dataclass

S3SinkConnector(backend: InMemoryS3Fake = InMemoryS3Fake(), force_fake: bool = True, _sessions: dict[str, dict[str, Any]] = dict())

Stage multipart uploads; commit via conditional pointer publication.

S3SourceConnector dataclass

S3SourceConnector(backend: InMemoryS3Fake = InMemoryS3Fake(), force_fake: bool = True)

Read committed S3 objects via commit-pointer resolution.

S3StorageConnector dataclass

S3StorageConnector(backend: InMemoryS3Fake = InMemoryS3Fake(), force_fake: bool = True)

Bounded schema inspection over committed S3 objects.

InMemoryS3Fake dataclass

InMemoryS3Fake(objects: dict[tuple[str, str], bytes] = dict(), etags: dict[tuple[str, str], str] = dict(), multiparts: dict[str, _MultipartUpload] = dict(), commit_pointers: dict[tuple[str, str], str] = dict(), _ops: list[dict[str, Any]] = list())

Deterministic S3 stub for unit tests (no network).

Semantics mirrored for CI:

  • Multipart uploads stage parts until complete or abort.
  • Abort discards parts and marks the upload aborted (orphan cleanup).
  • Commit pointers use conditional put (If-None-Match * by default): only one winner; losers see a precondition failure for reconciliation.
  • Readers resolve only the committed pointer, never incomplete multipart staging keys.

put_commit_pointer

put_commit_pointer(*, bucket: str, pointer_key: str, data_key: str, if_none_match: bool = True) -> dict[str, Any]

Conditionally publish a commit pointer to an immutable data object.

When if_none_match is True (default), succeeds only if the pointer does not already exist — concurrent losers get precondition_failed.

get_committed_object

get_committed_object(*, bucket: str, pointer_key: str) -> tuple[str, bytes] | None

Resolve pointer → immutable object; ignore incomplete multipart keys.

create_sink

create_sink() -> S3SinkConnector

Entry-point factory for etlantic.sink_connectors.

create_source

create_source() -> S3SourceConnector

Entry-point factory for etlantic.source_connectors.

create_storage

create_storage() -> S3StorageConnector

Entry-point factory for etlantic.storage_connectors.

boto3_available

boto3_available() -> bool

Return True when boto3 can be imported (live path opt-in).

etlantic-iceberg

etlantic_iceberg

Experimental Iceberg connector package for ETLantic.

FakeIcebergCatalog dataclass

FakeIcebergCatalog(tables: dict[str, FakeTable] = dict(), _next_snapshot_id: int = 1)

Stub catalog: snapshot id is the publication identity.

rollback

rollback(identifier: str, snapshot_id: int | None) -> None

Discard a staged snapshot that was never current (abort path).

etlantic-snowflake

etlantic_snowflake

Experimental Snowflake connector package for ETLantic.

FakeSnowflakeConnection dataclass

FakeSnowflakeConnection(autocommit: bool = False, tables: dict[str, list[dict[str, Any]]] = dict(), _txn: list[tuple[str, str, list[dict[str, Any]]]] = list(), _committed_queries: dict[str, FakeQueryResult] = dict(), _pending_queries: dict[str, FakeQueryResult] = dict(), _query_seq: int = 0)

Transactional fake: autocommit is always off.

Staged DML lives in a transaction buffer until commit() or rollback(). Every statement receives a stable query_id for CommitReceipt evidence and post-loss reconciliation.

etlantic-fastapi

etlantic_fastapi

Thin FastAPI adapter: control-plane API (CP1) + non-CP reference app.

Package version is 0.39.0 (CP1 gate-ready).

AuthoringService dataclass

AuthoringService(policy: PolicyContext = PolicyContext(), runtime: PipelineRuntime = PipelineRuntime(), definitions: dict[str, PipelineDefinition] = dict(), jobs: dict[str, RunJob] = dict())

In-memory facade mapping request models to public ETLantic operations.

Not a multi-tenant control plane. HTTP adapters (for example etlantic-fastapi) should bind host policy into PolicyContext.

negotiation

negotiation() -> dict[str, Any]

Return capability negotiation metadata for clients.

Returns:

Type Description
dict[str, Any]

Capability negotiation payload plus run_model.

Raises:

Type Description
PermissionError

If catalog is not an allowed action.

catalog

catalog(definition_id: str | None = None) -> dict[str, Any]

Return the authoring catalog, optionally scoped to a definition.

Parameters:

Name Type Description Default
definition_id str | None

Optional stored definition id to enrich the catalog.

None

Returns:

Type Description
dict[str, Any]

Catalog document as a dict.

Raises:

Type Description
PermissionError

If catalog is not allowed.

put_definition

put_definition(definition_id: str, document: dict[str, Any], *, idempotency_key: str | None = None) -> dict[str, Any]

Store a verified pipeline definition document.

Parameters:

Name Type Description Default
definition_id str

Host-assigned definition id.

required
document dict[str, Any]

etlantic.pipeline/1 mapping (fingerprint verified).

required
idempotency_key str | None

Reserved for adapters; ignored in this reference.

None

Returns:

Type Description
dict[str, Any]

Mapping with id, fingerprint, and definition.

Raises:

Type Description
PermissionError

If edit is not allowed or policy rejects the definition.

ValueError

On fingerprint / schema verification failure.

TypeError

If document is not a mapping.

get_definition

get_definition(definition_id: str) -> dict[str, Any]

Fetch a stored definition.

Parameters:

Name Type Description Default
definition_id str

Previously stored id.

required

Returns:

Type Description
dict[str, Any]

Mapping with id, fingerprint, and definition.

Raises:

Type Description
KeyError

If definition_id is unknown.

apply_edit

apply_edit(definition_id: str, command: dict[str, Any], *, expected_token: str | None = None) -> dict[str, Any]

Apply an immutable edit to a stored definition.

Parameters:

Name Type Description Default
definition_id str

Stored definition id.

required
command dict[str, Any]

EditCommand mapping (op, optional path / payload).

required
expected_token str | None

Optimistic concurrency token (fingerprint).

None

Returns:

Type Description
dict[str, Any]

Updated id, fingerprint, concurrency token, and definition.

Raises:

Type Description
PermissionError

If edit is not allowed or policy rejects.

KeyError

If the definition id is unknown.

ValueError

On concurrency or edit payload failures.

validate

validate(definition_id: str) -> dict[str, Any]

Structurally validate a stored definition for the policy profile.

Parameters:

Name Type Description Default
definition_id str

Stored definition id.

required

Returns:

Type Description
dict[str, Any]

Mapping with ok, diagnostics, and fingerprint.

Raises:

Type Description
PermissionError

If validate is not allowed or policy rejects.

KeyError

If the definition id is unknown.

plan

plan(definition_id: str) -> dict[str, Any]

Plan a stored definition for the policy profile.

Parameters:

Name Type Description Default
definition_id str

Stored definition id.

required

Returns:

Type Description
dict[str, Any]

Mapping with ok, diagnostics, and optional plan dict.

Raises:

Type Description
PermissionError

If plan is not allowed or policy rejects.

KeyError

If the definition id is unknown.

submit_run

submit_run(definition_id: str, *, idempotency_key: str | None = None) -> dict[str, Any]

Run synchronously (reference adapter — not a durable async queue).

Parameters:

Name Type Description Default
definition_id str

Stored definition id.

required
idempotency_key str | None

Reserved for adapters; ignored here.

None

Returns:

Type Description
dict[str, Any]

Job status mapping from job_status.

Raises:

Type Description
PermissionError

If run is not allowed or policy rejects.

KeyError

If the definition id is unknown.

cancel_run

cancel_run(job_id: str) -> dict[str, Any]

Reference adapter runs are synchronous; cancel is not supported in-flight.

Parameters:

Name Type Description Default
job_id str

Job id from submit_run.

required

Returns:

Type Description
dict[str, Any]

Status mapping with cancellable / cancel_supported false.

Raises:

Type Description
PermissionError

If cancel is not allowed.

KeyError

If the job id is unknown.

job_status

job_status(job_id: str) -> dict[str, Any]

Return status for a synchronous reference job.

Parameters:

Name Type Description Default
job_id str

Job id from submit_run.

required

Returns:

Type Description
dict[str, Any]

Status mapping including optional report.

Raises:

Type Description
PermissionError

If report is not allowed.

KeyError

If the job id is unknown.

PolicyContext dataclass

PolicyContext(tenant: str = 'default', environment: str = 'development', profile: str = 'development', allowed_assets: tuple[str, ...] | None = None, allowed_plugins: tuple[str, ...] | None = None, allowed_actions: tuple[str, ...] = ('catalog', 'validate', 'plan', 'edit', 'run', 'cancel', 'report'))

Host-supplied authority; client payloads cannot expand these grants.

Attributes:

Name Type Description
tenant str

Logical tenant label for the host (reference only).

environment str

Deployment environment label.

profile str

Profile name resolved for validate/plan/run.

allowed_assets tuple[str, ...] | None

When set, definition assets must be in this set.

allowed_plugins tuple[str, ...] | None

When set, profile allowlist and engine refs must match.

allowed_actions tuple[str, ...]

Actions the facade may perform.

ETLanticAPI dataclass

ETLanticAPI(authorizer: Authorizer, definitions: DefinitionRepository, submissions: SubmissionStore, events: EventStore, context_factory: ContextFactory, principal_dependency: PrincipalDependency = principal_from_header, profile: Any = 'development', history_store: HistoryStore | None = None, known_observation_ids: set[str] = set(), registry: RegistryProvider | None = None, durable_work: DurableWorkStore | None = None, title: str = 'ETLantic Control Plane', version: str = __version__)

Control-plane API holding injected stores and auth adapters.

Heavy pipeline work is never scheduled via FastAPI BackgroundTasks. Submission acceptance is a durable store commit only; optional pollers may observe accepted jobs without executing them in-request.

Optional registry enables /v1/registry admin routes (CP2). Use :meth:with_registry_definitions or definitions_backend="registry" so /v1/definitions* read/write through registry revisions without changing route paths or operationIds.

Optional durable_work enables /v1/durable/* host routes (CP3) and dual-writes durable accept on submit when fingerprints are present.

with_registry_definitions classmethod

with_registry_definitions(*, authorizer: Authorizer, registry: RegistryProvider, submissions: SubmissionStore, events: EventStore, context_factory: ContextFactory, principal_dependency: PrincipalDependency | None = None, **kwargs: Any) -> ETLanticAPI

Build an API whose /v1/definitions* use registry-backed storage.

LandingWatchSubmitter dataclass

LandingWatchSubmitter(watch_dir: Path, definition_id: str, submit_run: SubmitRun, binding_ref: Mapping[str, Any] = local_files_binding_ref(), tenant_id: str = 'default', workspace_id: str = 'default', poll_interval: float = 0.25, pattern: str = '*.csv', _seen: MutableMapping[str, float] = dict())

Stdlib polling loop that submits durable runs for new files.

Prefer this over optional watchdog so CP1 has zero extra deps.

poll_once

poll_once() -> list[Mapping[str, Any]]

Submit for newly seen files; return accept receipts.

run_until

run_until(stop: Event, *, max_submits: int | None = None) -> list[Mapping[str, Any]]

Poll until stop is set or max_submits receipts collected.

create_app

create_app(api: ETLanticAPI | None = None, *, authorizer: Authorizer | None = None, definitions: DefinitionRepository | None = None, submissions: SubmissionStore | None = None, events: EventStore | None = None, context_factory: ContextFactory | None = None, principal_dependency: PrincipalDependency | None = None, registry: RegistryProvider | None = None, durable_work: DurableWorkStore | None = None, definitions_backend: str | None = None, title: str | None = None, version: str | None = None, install_handlers: bool = True, with_lifespan: bool = True) -> FastAPI

Standalone control-plane app factory.

Optional lifespan wires injected stores onto app.state and verifies readiness. It does not start BackgroundTasks or execute pipelines.

definitions_backend="registry" requires registry and wraps it as :class:RegistryDefinitionRepository for stable /v1/definitions* routes. Default keeps an injected definitions store (callers must pass one when not using the registry backend).

include_router

include_router(app: FastAPI, api: ETLanticAPI, *, prefix: str = '') -> None

Embed the control-plane router without owning host lifecycle.

Does not install lifespan hooks, middleware, or exception handlers. Host applications should register Problem Details handlers and lifespan themselves when desired.

make_principal_from_header

make_principal_from_header(*, header: str = 'X-Principal') -> PrincipalDependency

Build a principal dependency that reads header from the request.

membership_context_factory

membership_context_factory(membership: MembershipMap) -> ContextFactory

Build a context factory that maps principal subjects via membership.

oauth2_oidc_principal_hook

oauth2_oidc_principal_hook(*, token_claims: Mapping[str, Any], subject_claim: str = 'sub', issuer_claim: str = 'iss') -> Principal

Placeholder OAuth2/OIDC claim → Principal mapping for host adapters.

Hosts that validate JWTs (or introspect tokens) via FastAPI security dependencies can call this after claims are verified. This function does not validate signatures or contact an IdP.

principal_dependency_from_callable

principal_dependency_from_callable(resolver: Callable[[Request], Principal]) -> PrincipalDependency

Wrap a host-defined principal resolver as a FastAPI dependency.

principal_from_header

principal_from_header(request: Request) -> Principal

Demo/test principal adapter reading an opaque X-Principal header.

Production hosts should replace this with OAuth2/OIDC or mTLS mapping.

static_context_factory

static_context_factory(*, tenant_id: str, workspace_id: str, environment: str = 'development', security_domain: str = 'default') -> ContextFactory

Fixed-scope context factory for single-tenant demos and unit tests.

assert_path_scope

assert_path_scope(ctx: ControlPlaneContext, *, tenant_id: str | None = None, workspace_id: str | None = None) -> None

Reject path scope that does not match server-derived context (404).

Spoofed path tenants must not disclose existence — map to opaque not_found.

make_context_dependency

make_context_dependency(api: ETLanticAPI) -> Callable[..., ControlPlaneContext]

Build a dependency that constructs server-derived context.

Path tenant/workspace segments are never treated as authority. When a route exposes those path params for routing, callers should verify them against the returned context via :func:assert_path_scope.

control_plane_error_handler

control_plane_error_handler(_request: Request, exc: ControlPlaneError) -> JSONResponse

Map :class:ControlPlaneError to an RFC 7807-shaped JSON body.

install_exception_handlers

install_exception_handlers(app: FastAPI) -> None

Install CP error handlers on a standalone app (not used by include_router).

local_files_binding_ref

local_files_binding_ref(*, root_ref: str = 'landing', root: str = 'inbox', glob: str = '*.csv', mode: str = 'snapshot', provider: str = 'local-files', format: str = 'csv') -> dict[str, Any]

0.38 local-files-style binding reference (paths/refs only, no bytes).

make_testclient_submit_run

make_testclient_submit_run(client: Any, *, principal: str = 'alice') -> SubmitRun

Adapt a FastAPI TestClient into a :data:SubmitRun callable.

create_reference_app

create_reference_app(*, service: AuthoringService | None = None, title: str = 'ETLantic Authoring Reference', version: str = __version__) -> FastAPI

Create a FastAPI app exposing the public authoring/service facade.

This is a non-CP sync demo. It is not the control plane and must not be treated as a multi-tenant production surface.

format_sse_message

format_sse_message(event: ControlPlaneEvent) -> str

Encode one ControlPlaneEvent as an SSE message (id = resume cursor).

sse_streaming_response

sse_streaming_response(events: EventStore, ctx: ControlPlaneContext, run_id: str, *, cursor: str | None, follow: bool = False, headers: Mapping[str, str] | None = None, max_polls: int | None = None, max_duration_s: float | None = None) -> StreamingResponse

Build a text/event-stream response for run events.

medallantic

medallantic

Medallantic — engine-agnostic medallion pipelines built on ETLantic.

AdaptationResult dataclass

AdaptationResult(pipeline_cls: type[Pipeline], profile: Profile, validation_policy: ValidationPolicy, write_intents: tuple[WriteIntent, ...] = (), step_map: dict[str, str] = dict(), layer_by_node: dict[str, str] = dict(), diagnostics: tuple[Diagnostic, ...] = (), metadata: dict[str, Any] = dict(), required_delta_operations: tuple[str, ...] = ())

Result of adapting a SparkForge pipeline IR.

AdapterError

AdapterError(message: str, *, report: ValidationReport | None = None, code: str = 'PMSF300')

Bases: Exception

Raised when SparkForge → ETLantic adaptation fails closed.

Bronze

Bronze(*, asset: str | None = None, source: str | None = None, write_mode: str | None = None, transform_ref: str | None = None, rules: dict[str, Any] | None = None, description: str | None = None, tags: tuple[str, ...] | list[str] | None = None, kind: str | None = None, metadata: dict[str, Any] | None = None, name: str | None = None)

Bases: LayerStep

Bronze ingest step (maps to an ETLantic Extract source).

Gold

Gold(*, source: str, write_mode: str = 'overwrite', **kwargs: Any)

Bases: LayerStep

Gold publish step (maps to step + optional sink).

MedallionPipeline

Class-style native medallion authoring.

Subclass and declare Bronze / Silver / Gold attributes, then call to_definition() or lower().

to_document classmethod

to_document() -> MedallionDocument

Return the facade-owned medallion document for this class.

from_dict classmethod

from_dict(data: dict[str, Any]) -> type[MedallionPipeline]

Build an anonymous MedallionPipeline subclass from a document dict.

lower classmethod

lower() -> LoweringResult

Lower this pipeline onto ETLantic Pipeline / definition surfaces.

to_definition classmethod

to_definition() -> PipelineDefinition

Return a sealed public PipelineDefinition.

Silver

Silver(*, source: str, write_mode: str = 'overwrite', **kwargs: Any)

Bases: LayerStep

Silver transform step (maps to step + optional sink).

MedallionBuilder

MedallionBuilder(name: str, *, schema: str = 'default', engine: str = 'local', description: str | None = None, tags: tuple[str, ...] | list[str] | None = None, min_bronze_rate: float = 90.0, min_silver_rate: float = 95.0, min_gold_rate: float = 98.0)

Fluent builder that produces a MedallionDocument / definition.

build

build() -> PipelineDefinition

Build a sealed public PipelineDefinition.

as_pipeline

as_pipeline() -> type

Return a MedallionPipeline subclass for class-style use.

LayerKind

Bases: StrEnum

SparkForge medallion layer (adapter-only vocabulary).

SparkForgePipelineSpec dataclass

SparkForgePipelineSpec(name: str, schema: str = 'default', steps: tuple[SparkForgeStepSpec, ...] = (), min_bronze_rate: float = 90.0, min_silver_rate: float = 95.0, min_gold_rate: float = 98.0, engine: str = 'spark', legacy_engine_extensions: tuple[str, ...] = (), metadata: dict[str, Any] = dict())

Complete SparkForge pipeline description (fixture-friendly).

parse classmethod

parse(data: dict[str, Any]) -> tuple[SparkForgePipelineSpec, list[Diagnostic]]

Parse IR and return any coercion / hygiene diagnostics.

SparkForgeStepSpec dataclass

SparkForgeStepSpec(name: str, kind: StepKind, layer: LayerKind, source: str | None = None, table_name: str | None = None, transform_ref: str | None = None, rules: dict[str, Any] = dict(), write_mode: str | None = None, metadata: dict[str, Any] = dict())

One SparkForge step in secret-free form.

StepKind

Bases: StrEnum

SparkForge step kinds represented in the compatibility IR.

LoweringError

LoweringError(message: str, *, report: ValidationReport | None = None, code: str = MDL100_EMPTY)

Bases: Exception

Raised when medallion → ETLantic lowering fails closed.

LoweringResult dataclass

LoweringResult(pipeline_cls: type[Pipeline], profile: Profile, validation_policy: ValidationPolicy, write_intents: tuple[WriteIntent, ...] = (), step_map: dict[str, str] = dict(), layer_by_node: dict[str, str] = dict(), diagnostics: tuple[Diagnostic, ...] = (), metadata: dict[str, Any] = dict(), required_delta_operations: tuple[str, ...] = ())

Result of lowering a medallion document onto ETLantic surfaces.

definition property

definition

Public PipelineDefinition with facade provenance/extensions.

enrich_plan

enrich_plan(plan: PipelinePlan) -> PipelinePlan

Attach write intents and incremental strategies onto the plan.

MedallionRow

Bases: Data

Generic row contract for medallion planning/parity (passthrough).

RuleDSLError

Bases: ValueError

Raised when a Medallantic rules shorthand cannot be parsed.

MedallionDocument dataclass

MedallionDocument(name: str, schema: str = 'default', steps: tuple[MedallionStep, ...] = (), min_bronze_rate: float = 90.0, min_silver_rate: float = 95.0, min_gold_rate: float = 98.0, engine: str = 'local', description: str | None = None, tags: tuple[str, ...] = (), metadata: dict[str, Any] = dict())

Declarative medallion pipeline document owned by Medallantic.

MedallionStep dataclass

MedallionStep(name: str, layer: str, kind: str, source: str | None = None, asset: str | None = None, transform_ref: str | None = None, rules: dict[str, Any] = dict(), write_mode: str | None = None, description: str | None = None, tags: tuple[str, ...] = (), metadata: dict[str, Any] = dict())

One bronze, silver, or gold step in a medallion document.

adapt_pipeline

adapt_pipeline(spec: SparkForgePipelineSpec, *, capabilities: PluginCapabilities | None = None, strict_delta: bool = True) -> AdaptationResult

Map a SparkForge pipeline IR to a concrete ETLantic Pipeline subclass.

adapt_profile

adapt_profile(spec: SparkForgePipelineSpec, *, name: str | None = None, bindings: dict[str, str] | None = None) -> Profile

Build an ETLantic Profile from SparkForge builder config.

adapt_validation_policy

adapt_validation_policy(spec: SparkForgePipelineSpec) -> ValidationPolicy

Map layer thresholds onto a named ValidationPolicy (metadata only).

enrich_plan

enrich_plan(plan: PipelinePlan, result: AdaptationResult) -> PipelinePlan

Place serialized write intents under plan.intents['write_intents'].

from_document

from_document(doc: MedallionDocument) -> type[MedallionPipeline]

Create an anonymous MedallionPipeline subclass from a document.

Raises:

Type Description
ValueError

When a step declares a layer outside bronze/silver/gold.

assert_delta_capabilities

assert_delta_capabilities(operations: list[str], *, capabilities: PluginCapabilities | None = None, strict: bool = True) -> list[Diagnostic]

Fail closed when declared Delta ops are unsupported by capabilities.

When capabilities is None and strict is True (default), emit errors so callers must supply a plugin that supports spark_delta before execution. When strict is False (plan-only), emit warnings instead.

retry_policy_from_sparkforge

retry_policy_from_sparkforge(raw: dict[str, Any] | None) -> RetryPolicy

Normalize SparkForge retry config into ETLantic RetryPolicy.

write_mode_from_sparkforge

write_mode_from_sparkforge(raw: str | None) -> WriteMode

Map a SparkForge write-mode string to ETLantic WriteMode.

write_mode_metadata

write_mode_metadata(raw: str | None) -> dict[str, Any]

Extra write-mode metadata preserved when modes collapse (e.g. partitions).

explain_medallion_plan

explain_medallion_plan(plan: PipelinePlan, *, definition: PipelineDefinition | None = None) -> dict[str, Any]

Merge core plan explain with medallion layer and lifecycle metadata.

enrich_lifecycle_event

enrich_lifecycle_event(event: LifecycleEvent | SecurityEvent, layer_by_node: dict[str, str]) -> LifecycleEvent | SecurityEvent

Attach medallion layer annotation when step is known.

layer_run_summary

layer_run_summary(report: PipelineRunReport, layer_by_node: dict[str, str]) -> dict[str, Any]

Summarize run report steps grouped by medallion layer.

lower_document

lower_document(doc: MedallionDocument, *, required_delta_operations: tuple[str, ...] = (), diagnostic_phase: str = 'medallion_authoring', allowed_transform_refs: tuple[str, ...] | None = None, transform_refs_fail_closed: bool = False, profile: Profile | None = None) -> LoweringResult

Map a medallion document to a concrete ETLantic Pipeline subclass.

Bronze/silver/gold remain facade metadata on layer_by_node; ETLantic core never sees medallion enums.

Importable transform_ref values are deny-by-default when transform_refs_fail_closed is True or when profile.security_mode is production. Pass allowed_transform_refs (or profile metadata medallantic.allowed_transform_refs) to permit specific callables.

medallion_development_profile

medallion_development_profile(**overrides: Any) -> Profile

Development profile with medallion observability defaults.

medallion_production_profile

medallion_production_profile(**overrides: Any) -> Profile

Production template — requires explicit plugin allowlist before deploy.

medallion_test_profile

medallion_test_profile(**overrides: Any) -> Profile

Test profile with strict validation and in-memory history.

adapt_run_result

adapt_run_result(payload: dict[str, Any], *, pipeline_id: str | None = None, profile: str = 'medallantic') -> PipelineRunReport

Convert a SparkForge-shaped result dict into PipelineRunReport.

Never retains secret-like keys or free-text credentials from the source payload. Unknown run statuses fail closed to failed with diagnostic PMSF500.

enforce_accept_rates

enforce_accept_rates(report: PipelineRunReport, *, policy_metadata: dict[str, Any], layer_by_node: dict[str, str] | None = None) -> PipelineRunReport

Fail a successful report when accept-rate thresholds are violated.

Returns the original report when thresholds pass or are absent. On violation, returns a replaced report with FAILED status and MDL120 diagnostics.

evaluate_accept_rates

evaluate_accept_rates(*, policy_metadata: dict[str, Any], validations: list[ValidationResult] | list[dict[str, Any]], layer: str | None = None) -> list[dict[str, Any]]

Compare validation accept rates against Medallantic layer thresholds.

Threshold keys live on ValidationPolicy.metadata as min_accept_rate_{ingest,clean,publish} (bronze/silver/gold). Returns a list of findings; empty when thresholds are satisfied or absent.

report_to_sparkforge_explain

report_to_sparkforge_explain(report: PipelineRunReport) -> dict[str, Any]

Dual-reporting helper: ETLantic report → SparkForge-shaped explain dict.

parse_rules_shorthand

parse_rules_shorthand(rules: dict[str, Any] | None, *, name: str | None = None) -> QualityRuleset

Parse column→shorthand lists into a portable quality ruleset.

Supported shorthands (strings)::

not_null
unique / uniqueness
regex:<pattern>
length:min:max | min_length:N | max_length:N
in:a|b|c
range:min:max
ge:N / le:N / gt:N / lt:N / eq:N / ne:N
custom:<name>

Structured dict forms are also accepted per entry.

bind_debug_session

bind_debug_session(pipeline_cls: type[Any], *, profile: str | Any = 'development') -> DebugSession

Return an ETLantic DebugSession for an adapted pipeline class.

debug_request_from_sparkforge

debug_request_from_sparkforge(*, mode: str | None = 'standard', run_until: str | None = None, run_one: str | None = None, run_from: str | None = None, skip_writes: bool = False, materialization: MaterializationPolicy | None = None, retry: dict[str, Any] | RetryPolicy | None = None, parameter_overrides: dict[str, dict[str, Any]] | None = None, implementation_overrides: dict[str, str] | None = None, invalidation: str | InvalidationMode | None = None) -> RunRequest

Build a RunRequest from SparkForge debug/session options.

skip_writes sets no_write=True only. Materialization stays DEFAULT unless the caller passes materialization= explicitly. VALIDATE intent also sets no_write=True.

intent_from_sparkforge

intent_from_sparkforge(mode: str | None) -> RunIntent

Map SparkForge run-mode strings to RunIntent.

selection_from_sparkforge

selection_from_sparkforge(*, run_until: str | None = None, run_one: str | None = None, run_from: str | None = None) -> RunSelection

Map SparkForge selective-execution flags to RunSelection.