Skip to main content

databricks.labs.dqx.contexts.workflow_context

WorkflowContext Objects

class WorkflowContext(GlobalContext)

WorkflowContext class that provides a context for workflows, including workspace configuration,

config

@cached_property
def config() -> WorkspaceConfig

Loads and returns the workspace configuration.

spark

@cached_property
def spark() -> SparkSession

Returns spark session.

run_config_name

@cached_property
def run_config_name() -> str | None

Returns run configuration name.

runnable_for_patterns

@cached_property
def runnable_for_patterns() -> bool

Returns run configuration name.

runnable_for_run_config

@cached_property
def runnable_for_run_config() -> bool

Returns run configuration name.

patterns

@cached_property
def patterns() -> str | None

Returns semicolon delimited list of location patterns to use.

exclude_patterns

@cached_property
def exclude_patterns() -> str | None

Returns semicolon delimited list of location patterns to exclude.

output_table_suffix

@cached_property
def output_table_suffix() -> str

Returns suffix to use for output tables.

quarantine_table_suffix

@cached_property
def quarantine_table_suffix() -> str

Returns suffix to use for quarantine tables.

run_config

@cached_property
def run_config() -> RunConfig

Loads and returns the run configuration.

product_info

@cached_property
def product_info() -> ProductInfo

Returns the ProductInfo instance for the runtime. If product_name is provided in named_parameters, it overrides the default product name. This is useful for testing or when the product name needs to be dynamically set at runtime.

workspace_client

@cached_property
def workspace_client() -> WorkspaceClient

Returns the WorkspaceClient instance.

installation

@cached_property
def installation() -> Installation

Returns the installation instance for the runtime.

resolved_patterns

@cached_property
def resolved_patterns() -> tuple[list[str], list[str]]

Returns a tuple of patterns and exclude patterns lists.

profiler

@cached_property
def profiler() -> ProfilerRunner

Returns the ProfilerRunner instance.

quality_checker

@cached_property
def quality_checker() -> QualityCheckerRunner

Returns the QualityCheckerRunner instance.

prepare_run_config

def prepare_run_config(run_config: RunConfig) -> RunConfig

Apply common path prefixing to a run configuration in-place and return it. Ensures custom check function paths and checks location are absolute in the Databricks Workspace.

Arguments:

  • run_config - The run configuration to prepare.

Returns:

The prepared run configuration.