Skip to content

LaktoryContext

laktory.models.LaktoryContext ยค

Bases: BaseModel

Runtime context object optionally injected into user-supplied functions by Laktory.

Passed as the laktory_context keyword argument when the called function's signature explicitly declares it. Contains references to the pipeline objects active at call time.

To opt in, add laktory_context=None to your function signature:

from laktory.models import LaktoryContext


def my_write(df, laktory_context: LaktoryContext = None) -> None:
    print(laktory_context.sink)
    print(laktory_context.node)

    return df
PARAMETER DESCRIPTION
node

Parent PipelineNode, or None when called outside a pipeline.

TYPE: Annotated[Any, SkipValidation] | VariableType DEFAULT: None

pipeline

Parent Pipeline, or None when called outside a pipeline.

TYPE: Annotated[Any, SkipValidation] | VariableType DEFAULT: None

sink

Current data sink.

TYPE: Annotated[Any, SkipValidation] | VariableType DEFAULT: None

source

Current data source.

TYPE: Annotated[Any, SkipValidation] | VariableType DEFAULT: None