Skip to content

connections

etl_craft.execution.connections

Connection tests run before a pipeline run starts.

run --pipeline_code and run --init-only test the connections the run will use before they start or resume it. A warehouse failure stops the run before any task starts; email failures are logged and left to the alert task or SLA hook to report:

  • the warehouse, when a task's handler is SQL or BUSINESS_RULES or cloning is on, and with cloning on, that the warehouse profile's schema, where cloning writes, exists;
  • the email relay, when a task's handler is EMAIL_ALERT, or SLA emails are on and the pipeline has an SLA.

The Engine DB needs no test of its own: finding the pipeline already used it. PYTHON scripts connect by themselves, so they add nothing. A single-writer warehouse (a DuckDB file) is not tested: there is no server to be down, and a running task may hold its one writer's lock.

SMTP_TEST_TIMEOUT_SECONDS module-attribute

SMTP_TEST_TIMEOUT_SECONDS = 10.0

How long the email relay test waits for the relay.

WAREHOUSE_HANDLERS module-attribute

WAREHOUSE_HANDLERS = frozenset({Handler.SQL, Handler.BUSINESS_RULES})

The handlers whose tasks the engine runs against the warehouse.

probe_warehouse

probe_warehouse(config: ConnectorConfig, engine_db: Engine | None = None, *, schema: bool = False) -> str | None

Open the warehouse as a task does and run SELECT 1; return the problem, or None.

With schema, the profile's schema must exist too.

probe_email_relay

probe_email_relay(config: ConnectorConfig) -> str | None

Reach the email relay using its TLS mode and send NOOP, or check sendmail.

Returns the problem, or None. It does not log in, so the test never spends an attempt against a relay that locks accounts out.

check_run_connections

check_run_connections(engine: Engine, config: ConnectorConfig, pipeline_code: str, handlers: set[str], *, sends_sla_email: bool = False) -> None

Test each connection a run of the pipeline uses; ConnectionTestError names failures.