Skip to content

get_path

Public callable

Resolve a configured Fabric path for an environment and target.

Parameters:

Name Type Description Default
env str

Environment key such as Sandbox, DE, or Prod.

required
target str

Target key such as Source, Unified, Product, or Warehouse.

required
config FrameworkConfig | PathConfig | None

Configuration that contains environment-to-target path mappings.

required

Returns:

Type Description
Any

Housepath-style object with workspace_id, house_id, house_name, and root.

Raises:

Type Description
ValueError

If config is missing, or if the environment/target mapping does not exist.

Examples:

>>> get_path("Sandbox", "Source", config=CONFIG)
Housepath(...)
Source code in src/fabricops_kit/config.py
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
def get_path(env: str, target: str, config: FrameworkConfig | PathConfig | None) -> Any:
    """Resolve a configured Fabric path for an environment and target.

    Parameters
    ----------
    env : str
        Environment key such as ``Sandbox``, ``DE``, or ``Prod``.
    target : str
        Target key such as ``Source``, ``Unified``, ``Product``, or ``Warehouse``.
    config : FrameworkConfig | PathConfig | None
        Configuration that contains environment-to-target path mappings.

    Returns
    -------
    Any
        Housepath-style object with ``workspace_id``, ``house_id``, ``house_name``, and ``root``.

    Raises
    ------
    ValueError
        If config is missing, or if the environment/target mapping does not exist.

    Examples
    --------
    >>> get_path("Sandbox", "Source", config=CONFIG)
    Housepath(...)
    """
    if config is None:
        raise ValueError("No Fabric config was provided. Pass a FrameworkConfig or PathConfig instance.")
    paths = config.path_config.paths if isinstance(config, FrameworkConfig) else config.paths
    if env not in paths:
        available_envs = ", ".join(sorted(paths.keys())) or "<none>"
        raise ValueError(f"Environment '{env}' was not found in Fabric config. Available environments: {available_envs}.")
    if target not in paths[env]:
        available_targets = ", ".join(sorted(paths[env].keys())) or "<none>"
        raise ValueError(f"Target '{target}' was not found under environment '{env}'. Available targets: {available_targets}.")
    return paths[env][target]