ematix-flow resolves the name "warehouse" through a layered chain
so you can keep secrets out of code.
Resolution chain
Highest priority first:
- Env var
EMATIX_FLOW_DSN_<NAME>— uppercase the name (EMATIX_FLOW_DSN_WAREHOUSE=postgres://...). - Env var
EMATIX_FLOW_DSN— only matches the literal namedefault. Convenient for one-off scripts. ./.ematix-flow.tomlin the current directory.~/.ematix-flow/connections.tomlfor user-wide defaults.- In-process registration —
register_connection(...),@ematix.connection, or inlineconfig.connect(url=...).
flow connections list # what's resolved + from where
flow connections check warehouse # connect + report
Declaring connections
Three interchangeable forms — pick whichever fits the workflow.
TOML file
# ~/.ematix-flow/connections.toml
[connections.warehouse]
url = "postgres://user:${WAREHOUSE_PASSWORD}@host/wh"
[connections.kafka_prod]
kind = "kafka"
bootstrap_servers = "${KAFKA_BOOTSTRAP}"
group_id = "ematix-flow"
${VAR} interpolation lets secrets stay out of the file.
@ematix.connection decorator
from ematix_flow import ematix
@ematix.connection
class warehouse:
kind = "postgres"
url = "${WAREHOUSE_DSN}"
@ematix.connection
class kafka_prod:
kind = "kafka"
bootstrap_servers = "${KAFKA_BOOTSTRAP}"
group_id = "ematix-flow"
sasl_plain_username = "${KAFKA_USER}"
sasl_plain_password = "${KAFKA_PASS}"
Typed instance + register_connection
from ematix_flow import PostgresConnection, register_connection
warehouse = register_connection(
PostgresConnection(name="warehouse", url="postgres://localhost/wh"),
)
Useful when the connection has to be built dynamically.
Credential redaction
Every typed connection redacts secrets in repr() by field-name match
(password, secret, secret_access_key, anything matching _password,
AMQP URL passwords, etc.). Printing a connection in a notebook will not
spill credentials.
Next: Pipelines.