Skip to content

Pipeline Config Workspace File

laktory.models.pipeline.orchestrators.pipelineconfigworkspacefile.PipelineConfigWorkspaceFile ¤

Bases: WorkspaceFile, PipelineChild

Workspace File storing pipeline configuration. Default values for path and access controls. Forced value for source.

BASE DESCRIPTION
content_base64

The base64-encoded file content. Conflicts with source. Use of content_base64 is discouraged, as it's increasing memory footprint of Terraform state and should only be used in exceptional circumstances, like creating a workspace file with configuration properties for a data pipeline

TYPE: str | None | VariableType DEFAULT: None

md5

TYPE: str | None | VariableType DEFAULT: None

object_id

Unique identifier for a workspace file

TYPE: int | None | VariableType DEFAULT: None

LAKTORY DESCRIPTION
access_controls

Access controls list

TYPE: list[AccessControl | VariableType] | VariableType DEFAULT: [AccessControl(variables={}, group_name='users', permission_level='CAN_READ', service_principal_name=None, user_name=None)]

dirpath

Workspace directory inside rootpath in which the workspace file is deployed. Used only if path is not specified.

TYPE: str | VariableType DEFAULT: None

path_

Workspace filepath for the file. Overwrite dirpath.

TYPE: str | VariableType DEFAULT: None

render_vars

If True, resolve ${vars.x} / ${{ expr }} placeholders in this file's content before upload. Resolved content is staged under settings.build_root; the staged copy is (re)written whenever Stack.build() runs (which preview, deploy, destroy and build all trigger).

TYPE: bool DEFAULT: False

source_

Path to file on local filesystem.

TYPE: str | VariableType DEFAULT: None

METHOD DESCRIPTION
build

Write config file to settings.build_root if

check_staged

Raise a clear error if this resource is configured for variable

ATTRIBUTE DESCRIPTION
filename

File filename

TYPE: str | None

filename property ¤

File filename

build() ¤

Write config file to settings.build_root if specified or default cache dir if not. These files may also be used when deployment is delegated to third parties like Databricks Declarative Bundles.

Source code in laktory/models/pipeline/orchestrators/pipelineconfigworkspacefile.py
74
75
76
77
78
79
80
81
82
83
84
def build(self):
    """
    Write config file to `settings.build_root` if
    specified or default cache dir if not. These files may also be used when
    deployment is delegated to third parties like Databricks Declarative Bundles.
    """
    filepath = Path(self.source)
    filepath.parent.mkdir(parents=True, exist_ok=True)
    logger.debug(f"Writing config file at {filepath}")
    with filepath.open(mode="w", encoding="utf-8") as fp:
        json.dump(self.content_dict, fp, indent=4)

check_staged() ¤

Raise a clear error if this resource is configured for variable rendering but its staged copy hasn't been written yet (i.e. .build() hasn't run). Guards against programmatic use that bypasses Stack.build() (the normal CLI flow always calls it before dumping resources).

Source code in laktory/models/resources/databricks/_renderablefile.py
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
def check_staged(self):
    """
    Raise a clear error if this resource is configured for variable
    rendering but its staged copy hasn't been written yet (i.e.
    `.build()` hasn't run). Guards against programmatic use that
    bypasses `Stack.build()` (the normal CLI flow always calls it
    before dumping resources).
    """
    if not self.render_vars:
        return
    staged = self._rendered_field_value
    if staged and not Path(staged).exists():
        raise RuntimeError(
            f"'{staged}' has not been rendered yet. Run `laktory build` "
            "(or `preview`/`deploy`, which trigger it automatically) "
            "before this resource is used."
        )