Functions

One registry serves every resolver (§5). A function takes at most the listed arguments; a missing optional argument takes its default.

Function

Arguments

Returns

lookup

path, default (optional), format (str, json, int, float or bool, optional)

the value at path; see lookup

get_secret

key

string

get_start_last_month

timezone='UTC', at

"2026-04-01T00:00:00+00:00"

get_end_last_month

timezone='UTC', at

"2026-04-30T23:59:59.999999+00:00"

get_start_date_last_month

timezone='UTC', at

"2026-04-01"

get_end_date_last_month

timezone='UTC', at

"2026-04-30"

get_last_month_period

language='EN' (EN or NO), timezone='UTC', at

"April 2026", "Mai 2026"

get_current_date

timezone='UTC', at

"2026-05-03"

get_day_of_month

timezone='UTC', at

3

get_previous_day_of_month

timezone='UTC', at

2

get_hour

timezone='UTC', at

1

get_previous_hour

timezone='UTC', at

0

get_iso_timestamp_now

timezone='UTC'

"2026-11-03T11:15:30+01:00"

get_unix_timestamp_now

timezone='UTC'

1793700930

str_join

one or more

string

secret

value

value, recorded as a secret (what resolve(strict=False) writes)

coalesce

two or more

the first argument with a value, with its JSON type

get_column_as_list

column, table

the column’s distinct values, in order: ["John", "Jane"]

get_value_from_dataframe

index, column, table

the value at that row and column

dataframe_to_json_array

table

the rows as a JSON text: "[{\"name\":\"John\"}]"

json_parse

text

the parsed JSON value

is_empty

value

true or false

is_string_empty, is_list_empty, is_dict_empty, is_dataframe_empty

value

true or false, for that type only

Examples use at = 2026-05-03T01:30:00Z.

The time a function computes from

Every built-in function depends only on its arguments, never on the context (get_secret aside: it checks keys against the context’s tenant). The date functions compute from the time in their last argument, at, converted to timezone:

@{get_start_date_last_month, Europe/Oslo, run.logical_at}           from the run's logical time
@{get_start_date_last_month, Europe/Oslo, '2026-03-01T00:00:00Z'}   from a fixed time
@{get_start_date_last_month, Europe/Oslo}                           from the current time
  • Pass the time the run is for (in a pipeline, run.logical_at: the schedule tick, a backfill date, or the trigger time) wherever a data window must be stable: every stage and retry of the run then gets the same value. Without at the function uses the current time, which differs between retries, stages, and backfills.

  • at is an RFC 3339 timestamp with Z or an offset and at most six fractional digits; anything else is an argument error (checked by validate for a literal). Quote a literal ('2026-03-01T00:00:00.5Z') so a dot is not read as a path. A reference with no value is a missing argument (missing_value; coalesce skips it).

  • get_iso_timestamp_now and get_unix_timestamp_now always use the current time: use them for request signing or expiry, not for data windows.

Arguments

  • timezone is an IANA name, case-sensitive (Europe/Oslo). An unknown name is an argument error.

  • Arguments may be references: @{get_hour, owner.settings.tz, run.logical_at}. A reference argument must resolve to a string.

  • get_previous_hour is one elapsed hour before at, so across a DST change it can equal get_hour (autumn) or skip an hour (spring).

  • str_join concatenates its arguments with no separator. A reference argument is rendered as text (true, 7, 2.0); an object or array is a type error. If the result is empty it is a missing value.

coalesce

coalesce is the only way to give a default. It reads its arguments left to right and returns the first one that has a value; later arguments are never read. If every one is missing it fails with missing_value.

@{coalesce, owner.settings.tz, Europe/Oslo}            owner's tz, else Europe/Oslo
@{coalesce, owner.settings.tz, variables.tz, UTC}      a chain
@{coalesce, execution.name, 'manual run'}              quote literals with spaces or commas
  • Only a missing value moves on: no such path, null, "", or blank. Every other error is raised when the argument is read: a namespace the context does not have (unknown_namespace, so a typo like ownr.x never falls back), a provider that fails, a type error.

  • Only the last argument may be a literal, and it must not be blank. A literal always has a value, so anything after it would never be read, and a blank one ('') never is a value. @{coalesce, UTC, owner.settings.tz} and @{coalesce, owner.settings.tz, ''} are argument errors, from validate and when resolved.

  • Quote a default that contains a dot: 'data.csv', 'v1.2', 's3.eu-west-1.amazonaws.com'. Bare, data.csv is a reference to a namespace data. Arguments after the first value are never read, so such a mistake, or a typo in a later reference, passes validate and only fails on the run where the earlier arguments are missing. Test the fallback path too.

  • Types: a reference keeps its JSON type, as a plain reference does. A literal is always a string, so @{coalesce, owner.settings.periods, 12} gives the owner’s 12 (a number) or "12" (a string). For a typed default, declare it as a variable and refer to it:

    "variables": {"periods": 12},
    "read": {"periods": "@{coalesce, owner.settings.periods, variables.periods}"}
    

    Declaring defaults as variables also keeps them in one place.

  • Embedded in text and in SQL it works like any placeholder: the result is rendered as text or as a SQL literal, and a value holding a secret is refused in SQL.

  • Don’t default what picks a tenant’s data or a secret path (a company key, a vault key): a missing owner setting there should fail, not quietly read something else.

lookup

@{lookup, owner.settings.tz}                        the same as @{owner.settings.tz}
@{lookup, owner}                                    the whole owner object
@{lookup, owner.settings.company_no, str}           "1234": text, even as the whole string
owner: @{lookup, owner, json}                       owner: {"id":"o1","settings":{…}}
export_@{lookup, owner.settings.company_no}.csv     export_1234.csv
@{lookup, owner.settings.tz, UTC}                   Europe/Oslo, or UTC when owner has no tz
@{lookup, owner.settings.n, 0, str}                 the default, then the format
@{lookup, owner.settings.retries, 3, int}           the value, or the number 3

lookup is a reference written as a call: @{owner.x} is short for @{lookup, owner.x}, and the two are the same placeholder. It is the only way to read a whole namespace: without a dot, @{owner} is a call to a function owner.

  • The first argument is a path, read as it is written, not resolved first: @{lookup, variables.field} is the value of variables.field, never the value at the path it holds. A bare name is the whole namespace. The path cannot be quoted (@{lookup, 'owner'} is a syntax error); quote a key inside it as in any reference (owner.settings.'company.key').

  • Without a format it behaves exactly as the reference: the whole string keeps the value’s JSON type, and inside a longer string the value is its text, so it builds file names and labels. An object or array in a longer string is a type error.

  • str: the value’s text, even when the placeholder is the whole string (1234 becomes "1234", true becomes "true"). An object or array is a type error.

  • int, float, bool: the value as that JSON type, also as the whole string. The value must be that type or text that spells it ("3", "2.5", "true"); nothing is guessed, so "yes" is not a boolean. int also takes a whole float (4.0). Anything else is a type error. The default is read as that type, and one that is not is an argument error when the placeholder is read.

  • json: compact JSON, non-ASCII escaped, for any value: an object, an array, a string (quoted: "o1"), a DataFrame as its rows (as dataframe_to_json_array gives them), also inside an object or array (@{lookup, tasks.<id>, json}). Use it to put an object in text.

  • default: the text read when there is no value (a missing path, null, or blank). It is written out, never a placeholder, and is always a string, whatever the format; quote it to include , or } ('a, b'). It is not blank. Any other error, such as an unknown namespace, is still raised. For a default that is itself read, use coalesce. A last argument that is str, json, int, float or bool is the format, so those words cannot be a default. A default is text unless the format types it.

  • Without a default, a missing path, null, or blank is missing_value, as for any reference. More than one default, or an argument that is neither a default nor a format, is argument; no argument, or more than three, is arity.

  • tasks cannot be read whole: it holds every task’s output, so @{lookup, tasks} is argument. Name the task: @{lookup, tasks.<id>}.

  • At a SQL path the result is a literal like any other value; one that contains a secret this context read is refused.

  • As an argument of another function, @{lookup, …} is the reference itself: @{get_secret, @{lookup, owner.settings.client_key}} is @{get_secret, owner.settings.client_key}, and with a format the argument is the formatted value (@{str_join, @{lookup, owner, json}}). Its own path, default and format are written out, never nested placeholders (argument). A service cannot add a function called lookup.

Tables and values

These behave as ds-workflow-manager’s builtins of the same names, so a workflow keeps working when it moves to standard.

@{get_column_as_list, account_id, tasks.read.output}       distinct ids, in order
@{get_value_from_dataframe, 0, total, tasks.sum.output}    row 0's total
@{is_empty, tasks.read.output}                             true for no rows
@{json_parse, variables.config_json}                       the parsed object
  • A table is a JSON array of objects, or a pandas DataFrame. The package does not depend on pandas: it recognises a frame by its interface and reads it through that (a column, a cell), without converting the whole frame. A frame whose column names are not unique as text (a twice, or 0 and "0") is an argument error.

  • get_value_from_dataframe reads a DataFrame’s row by its index label, as the manager does (after a filter, the labels keep their gaps), and an array’s by position. The index is an integer, or text or a number that is one (2, "2", 2.0); 1.9 is an argument error. A frame whose row labels repeat, or have several levels, is an argument error.

  • get_column_as_list returns each value once, in order, as the manager’s does. Numbers are equal by value (1 and 1.0 are one); a boolean is not a number.

  • dataframe_to_json_array writes compact JSON with non-ASCII escaped, the same text for a DataFrame and for an array of the same rows, with column labels as text ({"0": …} for a frame without a header). Unlike the manager’s pandas to_json: / is not escaped, floats are written in full (0.30000000000000004), and timestamps are ISO 8601 text, not epoch milliseconds. A consumer that parsed epoch numbers must change when its workflow moves to standard.

  • Arguments are passed as values, not only strings: a reference argument may hold a table, a list, or an object. null or blank, from a reference or a literal (''), is passed as no value (is_empty of it is true, json_parse of it is missing_value). A literal is always text: null is the four letters. A path that does not exist is missing_value, as for any reference.

  • Results are plain JSON: numpy values become Python ones (arrays lists), NaN, NaT, pd.NA, and infinite numbers become null, timestamps ISO 8601 text, Decimal a number (an integral one exactly, any other as a float, which can round: a NUMERIC column that needs every digit should be cast to text before it is read). A list or object result must be the whole value, as any; a DataFrame can never be the result.

  • Errors: an empty table, no such column or row, or a null cell is missing_value; a value of the wrong kind is type (is_list_empty of a string, get_column_as_list of a number); invalid JSON for json_parse is argument. Any other failure inside a function is argument naming only the exception type. Messages never include the arguments’ values. A nested table function with no value is a missing argument, so coalesce gives a default for it: @{coalesce, @{get_value_from_dataframe, 0, id, tasks.read.output}, none}.

  • A table or value function over a secret (@{get_value_from_dataframe, 0, password, @{json_parse, @{get_secret, …}}}) returns part of it. When a secret was read for its arguments, every string in its result of 6 or more characters (after trimming blanks) is recorded as a secret, so scrub masks it and SQL refuses it, and so refuses any later value that contains it. That includes harmless fields of the same secret, such as a user name. Shorter strings and numbers are not recorded: keep a short credential (a PIN) as its own vault key and read it whole with get_secret. Only a secret read for that call’s own arguments counts: a JSON secret first resolved into a variable and parsed by a later placeholder is not split into parts.

  • is_empty takes a string, array, object, or table. The other is_* checks take only their own type (is_dataframe_empty: a DataFrame or an array of objects); null is empty for all of them.

A service’s own functions

A service adds functions to its context; they are known only there.

def get_rate(base: str, quote: str = "EUR") -> float: ...

ctx = Context.from_values({**values, "fx": {"rate": "@{get_rate, NOK}"}}, functions={"get_rate": get_rate})
ctx.resolve("fx.rate")                               # get_rate("NOK")

validate(definition, functions={"get_rate": get_rate})   # counts checked
validate(definition, functions={"get_rate"})             # by name only
  • Each is called with the arguments’ values, positionally, like the table functions: a reference argument as the provider holds it, null or blank as None. Its signature sets how many arguments it takes (arity otherwise). The result is converted to plain JSON; None or blank is missing_value.

  • An exception it raises becomes argument, naming only the exception type. To report a missing value, raise MissingValue. An async function is refused when the context is built.

  • It gets the provider’s own objects (a DataFrame is not copied): never change an argument in place.

  • A secret inside a JSON text inside a cell is escaped twice by dataframe_to_json_array, and scrub and the SQL check do not see it there. Don’t put secrets in task outputs.

  • It must not return a secret: its result is not recorded as one (unless a secret was read for one of its arguments, see the table and value functions), so scrub and the SQL check do not know it, and resolve(strict=False) does not read it. Put secrets in the vault and read them with get_secret.

  • A built-in name cannot be replaced, and building the context fails if one is given. A later version that adds a built-in with the same name makes that explicit: rename the service’s function then.

  • Every validator of the same definitions must know the same names, or they are unknown_function there. Where the functions are not at hand (ds-config, the router), pass the names.

Testing with a fixed clock

A function given at needs nothing special. For the current time (a date function without at, and the _now functions), use the test helper:

from ds_common_placeholder_py_lib import Context
from ds_common_placeholder_py_lib.testing import fixed_now

ctx = Context.from_values({"tenant_id": "t1", "run": {"at": "@{get_unix_timestamp_now}"}})
with fixed_now("2026-11-03T10:15:30Z"):
    ctx.resolve("run.at")   # 1793700930

Like fake_vault, it applies to the current thread or async task only.

Not in standard

get_ssm_secret (no tenant scope; move the secret to the vault and use get_secret) and new_uuid4 (differs on every retry) stay legacy only. Using one in a standard definition is an unknown_function error.

Adding a function is a contract change: the registry, the conformance vectors, and a version bump go together.