ds-common-placeholder-py-lib¶
The Python implementation of the standard placeholder dialect. It parses,
validates, resolves, and scrubs @{…} placeholders in computing-block
definitions: pipelines (bronze and silver) and workflows that opt in, and
resolves the secrets the dispatchers send to their workers (workflows and
clones).
The rules come from the placeholder contract. Section numbers (§) in these pages refer to it. Where these pages and the contract disagree, the contract wins.
from ds_common_placeholder_py_lib import Context, validate
errors = validate(definition) # at save time: syntax and dialect
ctx = Context.from_values( # once per run
{"tenant_id": tenant_id, "run": run, "variables": declared_variables, "job": job},
verbatim=["run"], # data, never parsed
sql=["job.transform.sql_query"], # SQL text
)
resolved = ctx.resolve("job.settings") # one part, right before use
everything = ctx.resolve() # or the whole context
job = ctx.resolve("job", strict=False) # dispatcher, for a worker without vault access
The package knows the dialect, not the computing blocks. Each service passes
the namespace values it has, as plain JSON; a namespace it does not pass does
not exist. The context is self-contained: the parts of the definition and
every value they read. Values may hold placeholders, resolved when read;
paths listed in verbatim are data, taken as written, and paths listed in
sql are SQL text. The package reads secrets from ds-vault itself; nothing resolved
outlives the run that resolved it.
Guide
API reference