typeError when trying to using dbt-dry-run

The problem I’m having

Just installed dbt-dry-run with pip but when I run the command dbt-dry-run I’ve the following error TypeError: a string or stream input is required

The context of why I’m trying to do this

I’m using dbt-bigquery 1.4.3 et dbt-dry-run v0.7.1

What I’ve already tried

What I understand from the log is it couldn’t parse dbt_project.yaml, I tried to add a project-dir flag but it didn’t work.

Some example code or error messages

> dbt-dry-run                              
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ c:\users\dbt_project\.venv\lib\site-packages\dbt_dry_run\cli │
│ .py:117 in run                                                                                   │
│                                                                                                  │
│   114 │   ),                                                                                     │
│   115 │   _: Optional[bool] = Option(None, "--version", callback=version_callback),              │
│   116 ) -> None:                                                                                 │
│ ❱ 117 │   exit_code = dry_run(                                                                   │
│   118 │   │   project_dir,                                                                       │
│   119 │   │   profiles_dir,                                                                      │
│   120 │   │   target,                                                                            │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │                                _ = None                                                      │ │
│ │ extra_check_columns_metadata_key = None                                                      │ │
│ │                     full_refresh = False                                                     │ │
│ │                     profiles_dir = 'C:/Users/dbt_project… │ │
│ │                      project_dir = 'C:\\Users\\dbt_project… │ │
│ │                      report_path = None                                                      │ │
│ │                skip_not_compiled = False                                                     │ │
│ │                           target = None                                                      │ │
│ │                      target_path = None                                                      │ │
│ │                          threads = None                                                      │ │
│ │                             vars = '{}'                                                      │ │
│ │                          verbose = False                                                     │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ c:\users\dbt_project\.venv\lib\site-packages\dbt_dry_run\cli │
│ .py:48 in dry_run                                                                                │
│                                                                                                  │
│    45 │   │   vars=cli_vars_parsed,                                                              │
│    46 │   │   threads=threads,                                                                   │
│    47 │   )                                                                                      │
│ ❱  48 │   project = ProjectService(args)                                                         │
│    49 │   exit_code: int                                                                         │
│    50 │   try:                                                                                   │
│    51 │   │   dry_run_results = dry_run_manifest(project)                                        │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │                             args = DbtArgs(                                                  │ │
│ │                                    │                                                         │ │
│ │                                    profiles_dir='C:\\Users\\dbt_project… │ │
│ │                                    │                                                         │ │
│ │                                    project_dir='C:\\Users\\dbt_project… │ │
│ │                                    │   profile=None,                                         │ │
│ │                                    │   target=None,                                          │ │
│ │                                    │   target_path=None,                                     │ │
│ │                                    │   vars={},                                              │ │
│ │                                    │   threads=None                                          │ │
│ │                                    )                                                         │ │
│ │                         cli_vars = '{}'                                                      │ │
│ │                  cli_vars_parsed = {}                                                        │ │
│ │ extra_check_columns_metadata_key = None                                                      │ │
│ │                     full_refresh = False                                                     │ │
│ │                     profiles_dir = 'C:/Users/dbt_project… │ │
│ │                      project_dir = 'C:\\Users\\dbt_project… │ │
│ │                      report_path = None                                                      │ │
│ │                skip_not_compiled = False                                                     │ │
│ │                           target = None                                                      │ │
│ │                      target_path = None                                                      │ │
│ │                          threads = None                                                      │ │
│ │                          verbose = False                                                     │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ c:\users\dbt_project\.venv\lib\site-packages\dbt_dry_run\ada │
│ pter\service.py:40 in __init__                                                                   │
│                                                                                                  │
│   37 │   def __init__(self, args: DbtArgs):                                                      │
│   38 │   │   self._args = args                                                                   │
│   39 │   │   set_dbt_args(self._args)                                                            │
│ ❱ 40 │   │   dbt_project, dbt_profile = RuntimeConfig.collect_parts(self._args)                  │
│   41 │   │   self._profile = dbt_profile                                                         │
│   42 │   │   self._config = RuntimeConfig.from_parts(dbt_project, dbt_profile, self._args)       │
│   43 │   │   reset_adapters()                                                                    │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ args = DbtArgs(                                                                              │ │
│ │        │                                                                                     │ │
│ │        profiles_dir='C:\\Users\\dbt_project… │ │
│ │        │                                                                                     │ │
│ │        project_dir='C:\\Users\\dbt_project… │ │
│ │        │   profile=None,                                                                     │ │
│ │        │   target=None,                                                                      │ │
│ │        │   target_path=None,                                                                 │ │
│ │        │   vars={},                                                                          │ │
│ │        │   threads=None                                                                      │ │
│ │        )                                                                                     │ │
│ │ self = <dbt_dry_run.adapter.service.ProjectService object at 0x000001B4D587BAC0>             │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ c:\users\dbt_project\.venv\lib\site-packages\dbt\config\runt │
│ ime.py:205 in collect_parts                                                                      │
│                                                                                                  │
│   202 │   @classmethod                                                                           │
│   203 │   def collect_parts(cls: Type["RuntimeConfig"], args: Any) -> Tuple[Project, Profile]:   │
│   204 │   │                                                                                      │
│ ❱ 205 │   │   cli_vars: Dict[str, Any] = parse_cli_vars(getattr(args, "vars", "{}"))             │
│   206 │   │                                                                                      │
│   207 │   │   profile = cls.collect_profile(args=args)                                           │
│   208 │   │   project_renderer = DbtProjectYamlRenderer(profile, cli_vars)                       │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ args = DbtArgs(                                                                              │ │
│ │        │                                                                                     │ │
│ │        profiles_dir='C:\\Users\\dbt_project… │ │
│ │        │                                                                                     │ │
│ │        project_dir='C:\\Users\\dbt_project… │ │
│ │        │   profile=None,                                                                     │ │
│ │        │   target=None,                                                                      │ │
│ │        │   target_path=None,                                                                 │ │
│ │        │   vars={},                                                                          │ │
│ │        │   threads=None                                                                      │ │
│ │        )                                                                                     │ │
│ │  cls = <class 'dbt.config.runtime.RuntimeConfig'>                                            │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ c:\users\dbt_project\.venv\lib\site-packages\dbt\config\util │
│ s.py:16 in parse_cli_vars                                                                        │
│                                                                                                  │
│   13                                                                                             │
│   14                                                                                             │
│   15 def parse_cli_vars(var_string: str) -> Dict[str, Any]:                                      │
│ ❱ 16 │   return parse_cli_yaml_string(var_string, "vars")                                        │
│   17                                                                                             │
│   18                                                                                             │
│   19 def parse_cli_yaml_string(var_string: str, cli_option_name: str) -> Dict[str, Any]:         │
│                                                                                                  │
│ ╭──── locals ─────╮                                                                              │
│ │ var_string = {} │                                                                              │
│ ╰─────────────────╯                                                                              │
│                                                                                                  │
│ c:\users\dbt_project\.venv\lib\site-packages\dbt\config\util │
│ s.py:21 in parse_cli_yaml_string                                                                 │
│                                                                                                  │
│   18                                                                                             │
│   19 def parse_cli_yaml_string(var_string: str, cli_option_name: str) -> Dict[str, Any]:         │
│   20 │   try:                                                                                    │
│ ❱ 21 │   │   cli_vars = yaml_helper.load_yaml_text(var_string)                                   │
│   22 │   │   var_type = type(cli_vars)                                                           │
│   23 │   │   if var_type is dict:                                                                │
│   24 │   │   │   return cli_vars                                                                 │
│                                                                                                  │
│ ╭───────── locals ─────────╮                                                                     │
│ │ cli_option_name = 'vars' │                                                                     │
│ │      var_string = {}     │                                                                     │
│ ╰──────────────────────────╯                                                                     │
│                                                                                                  │
│ c:\users\dbt_project\.venv\lib\site-packages\dbt\clients\yam │
│ l_helper.py:56 in load_yaml_text                                                                 │
│                                                                                                  │
│   53                                                                                             │
│   54 def load_yaml_text(contents, path=None):                                                    │
│   55 │   try:                                                                                    │
│ ❱ 56 │   │   return safe_load(contents)                                                          │
│   57 │   except (yaml.scanner.ScannerError, yaml.YAMLError) as e:                                │
│   58 │   │   if hasattr(e, "problem_mark"):                                                      │
│   59 │   │   │   error = contextualized_yaml_error(contents, e)                                  │
│                                                                                                  │
│ ╭──── locals ─────╮                                                                              │
│ │ contents = {}   │                                                                              │
│ │     path = None │                                                                              │
│ ╰─────────────────╯                                                                              │
│                                                                                                  │
│ c:\users\dbt_project\.venv\lib\site-packages\dbt\clients\yam │
│ l_helper.py:51 in safe_load                                                                      │
│                                                                                                  │
│   48                                                                                             │
│   49                                                                                             │
│   50 def safe_load(contents) -> Optional[Dict[str, Any]]:                                        │
│ ❱ 51 │   return yaml.load(contents, Loader=SafeLoader)                                           │
│   52                                                                                             │
│   53                                                                                             │
│   54 def load_yaml_text(contents, path=None):                                                    │
│                                                                                                  │
│ ╭─── locals ────╮                                                                                │
│ │ contents = {} │                                                                                │
│ ╰───────────────╯                                                                                │
│                                                                                                  │
│ c:\users\dbt_project\.venv\lib\site-packages\yaml\__init__.p │
│ y:79 in load                                                                                     │
│                                                                                                  │
│    76 │   Parse the first YAML document in a stream                                              │
│    77 │   and produce the corresponding Python object.                                           │
│    78 │   """                                                                                    │
│ ❱  79 │   loader = Loader(stream)                                                                │
│    80 │   try:                                                                                   │
│    81 │   │   return loader.get_single_data()                                                    │
│    82 │   finally:                                                                               │
│                                                                                                  │
│ ╭───────────────── locals ──────────────────╮                                                    │
│ │ Loader = <class 'yaml.cyaml.CSafeLoader'> │                                                    │
│ │ stream = {}                               │                                                    │
│ ╰───────────────────────────────────────────╯                                                    │
│                                                                                                  │
│ c:\users\dbt_project\.venv\lib\site-packages\yaml\cyaml.py:2 │
│ 6 in __init__                                                                                    │
│                                                                                                  │
│    23 class CSafeLoader(CParser, SafeConstructor, Resolver):                                     │
│    24 │                                                                                          │
│    25 │   def __init__(self, stream):                                                            │
│ ❱  26 │   │   CParser.__init__(self, stream)                                                     │
│    27 │   │   SafeConstructor.__init__(self)                                                     │
│    28 │   │   Resolver.__init__(self)                                                            │
│    29                                                                                            │
│                                                                                                  │
│ ╭──────────────────────────── locals ────────────────────────────╮                               │
│ │   self = <yaml.cyaml.CSafeLoader object at 0x000001B4D4FD7650> │                               │
│ │ stream = {}                                                    │                               │
│ ╰────────────────────────────────────────────────────────────────╯                               │
│                                                                                                  │
│ in yaml._yaml.CParser.__init__:288                                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: a string or stream input is required

Solved by downgrading dbt-dry-run to v0.6.6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.