Skip to content

check_model_directories

This check identifies cases where models are not in the standard directory based on their type.

Version History

Added in Debby v0.3.0

Parameters

This check does not support any custom parameters.

Info

For more information about how to set custom parameters for a check, see the documentation on configuration.

Source

def check(model: dict, parents: list[dict]):
    if model["name"].startswith("dim_") or model["name"].startswith("fct_"):
        assert model["original_file_path"].startswith("models/marts")
    elif model["name"].startswith("int_"):
        assert model["original_file_path"].startswith("models/intermediate")
    elif model["name"].startswith("stg_"):
        assert model["original_file_path"].startswith("models/staging")
        source_name = Path(model["original_file_path"]).parts[2]
        for parent in parents:
            if parent["resource_type"] == "source":
                assert parent["source_name"] == source_name