# Path: clouddq/utils.py
# def assert_not_none_or_empty(value: typing.Any, error_msg: str) -> None:
#     """
# 
#     Args:
#       value: typing.Any:
#       error_msg: str:
# 
#     Returns:
# 
#     """
#     if not value:
#         raise ValueError(error_msg)
# 
# Path: clouddq/utils.py
# def load_yaml(file_path: Path, key: str = None) -> typing.Any:
#     with file_path.open() as f:
#         yaml_configs = yaml.safe_load(f)
#     if not yaml_configs:
#         return dict()
#     output = yaml_configs.get(key, dict())
#     if type(output) == dict:
#         return {key.upper(): value for key, value in output.items()}
#     elif type(output) == list:
#         return [item.upper() for item in output]
#     elif type(output) == str:
#         return output
#     else:
#         raise RuntimeError(
#             f"CloudDQ configs file `{file_path}` has empty config node type `{key}:`. "
#             "Please remove the node if it is not being used."
#         )
# 
# Path: clouddq/utils.py
# @contextlib.contextmanager
# def working_directory(path):
#     """Changes working directory and returns to previous on exit."""
#     prev_cwd = Path.cwd()
#     os.chdir(path)
#     try:
#         yield
#     finally:
#         os.chdir(prev_cwd)


from pathlib import Path
from pprint import pformat
from typing import Dict
from typing import Optional
from dbt.main import main as dbt
from clouddq.utils import assert_not_none_or_empty
from clouddq.utils import load_yaml
from clouddq.utils import working_directory
import json
import logging
import os
import re
    environment: str = "clouddq",
    debug: bool = False,
    dry_run: bool = False,
) -> None:
    """

    Args:
      dbt_path: Path: Path of dbt project described in `dbt_project.yml`
      dbt_profile_dir: str:
      configs: typing.Dict:
      environment: str:
      debug: bool:  (Default value = False)
      dry_run: bool:  (Default value = False)

    Returns:

    """
    if not configs:
        configs = {}
    command = []
    command.extend(["run"])
    command += [
        "--profiles-dir",
        str(dbt_profile_dir),
        "--vars",
        json.dumps(configs),
        "--target",
        environment,
    ]
    try:

# Path: clouddq/utils.py
# def assert_not_none_or_empty(value: typing.Any, error_msg: str) -> None:
#     """
# 
#     Args:
#       value: typing.Any:
#       error_msg: str:
# 
#     Returns:
# 
#     """
#     if not value:
#         raise ValueError(error_msg)
# 
# Path: clouddq/utils.py
# def load_yaml(file_path: Path, key: str = None) -> typing.Any:
#     with file_path.open() as f:
#         yaml_configs = yaml.safe_load(f)
#     if not yaml_configs:
#         return dict()
#     output = yaml_configs.get(key, dict())
#     if type(output) == dict:
#         return {key.upper(): value for key, value in output.items()}
#     elif type(output) == list:
#         return [item.upper() for item in output]
#     elif type(output) == str:
#         return output
#     else:
#         raise RuntimeError(
#             f"CloudDQ configs file `{file_path}` has empty config node type `{key}:`. "
#             "Please remove the node if it is not being used."
#         )
# 
# Path: clouddq/utils.py
# @contextlib.contextmanager
# def working_directory(path):
#     """Changes working directory and returns to previous on exit."""
#     prev_cwd = Path.cwd()
#     os.chdir(path)
#     try:
#         yield
#     finally:
#         os.chdir(prev_cwd)


# Path: clouddq/runners/dbt/dbt_utils.py
from pathlib import Path
from pprint import pformat
from typing import Dict
from typing import Optional
from dbt.main import main as dbt
from clouddq.utils import assert_not_none_or_empty
from clouddq.utils import load_yaml
from clouddq.utils import working_directory
import json
import logging
import os
import re

    environment: str = "clouddq",
    debug: bool = False,
    dry_run: bool = False,
) -> None:
    """

    Args:
      dbt_path: Path: Path of dbt project described in `dbt_project.yml`
      dbt_profile_dir: str:
      configs: typing.Dict:
      environment: str:
      debug: bool:  (Default value = False)
      dry_run: bool:  (Default value = False)

    Returns:

    """
    if not configs:
        configs = {}
    command = []
    command.extend(["run"])
    command += [
        "--profiles-dir",
        str(dbt_profile_dir),
        "--vars",
        json.dumps(configs),
        "--target",
        environment,
    ]
    try:

        with working_directory(dbt_path):