Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running the command when no dbt_project.yml is available crashes #87

Closed
b-per opened this issue Jun 30, 2023 · 2 comments · Fixed by #163
Closed

Running the command when no dbt_project.yml is available crashes #87

b-per opened this issue Jun 30, 2023 · 2 comments · Fixed by #163
Assignees
Labels
bug Something isn't working
Milestone

Comments

@b-per
Copy link
Contributor

b-per commented Jun 30, 2023

Describe the bug

Runtime Error
  No dbt_project.yml found at expected path /mypath/dbt-meshify/dbt_project.yml
  Verify that each entry within packages.yml (and their transitive dependencies) contains a file named dbt_project.yml
  
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/mypath/cli.py", line 74, in wrapper_decorator
    return func(*args, **kwargs)
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/mypath/main.py", line 237, in group
    ctx.forward(create_group)
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/click/core.py", line 781, in forward
    return __self.invoke(__cmd, *args, **kwargs)
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/mypath/cli.py", line 74, in wrapper_decorator
    return func(*args, **kwargs)
  File "/mypath/main.py", line 182, in create_group
    project = DbtProject.from_directory(path)
  File "/mypath/dbt_projects.py", line 172, in from_directory
    manifest=dbt.parse(directory),
  File "/mypath/dbt.py", line 28, in parse
    return self.invoke(directory, ["--quiet", "parse"])
  File "/mypath/dbt.py", line 24, in invoke
    raise result.exception
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/dbt/cli/requires.py", line 86, in wrapper
    result, success = func(*args, **kwargs)
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/dbt/cli/requires.py", line 71, in wrapper
    return func(*args, **kwargs)
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/dbt/cli/requires.py", line 139, in wrapper
    profile = load_profile(flags.PROJECT_DIR, flags.VARS, flags.PROFILE, flags.TARGET, threads)
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/dbt/config/runtime.py", line 65, in load_profile
    raw_project = load_raw_project(project_root)
  File "/mypath/dbt-meshify/.venv/lib/python3.9/site-packages/dbt/config/project.py", line 170, in load_raw_project
    raise DbtProjectError(MISSING_DBT_PROJECT_ERROR.format(path=project_yaml_filepath))
dbt.exceptions.DbtProjectError: Runtime Error
  No dbt_project.yml found at expected path /mypath/dbt-meshify/dbt_project.yml
  Verify that each entry within packages.yml (and their transitive dependencies) contains a file named dbt_project.yml

Steps to reproduce

Run poetry run dbt-meshify group finance --owner-name "Monopoly Man" -s +tag:finance where there is no dbt project

Expected results

An error message is raised but doesn't crash the program

@b-per b-per added bug Something isn't working triage Tis issue or pull request must be triaged by a project maintainer labels Jun 30, 2023
@dave-connors-3
Copy link
Collaborator

hey @b-per

  1. to confirm, this was executed in a directory that was not a dbt project? the --project-path flag is meant to get around this!
  2. what is your expectation for how the package should handle this?

@b-per
Copy link
Contributor Author

b-per commented Jul 5, 2023

I was running it from a "wrong" folder and didn't provide --project-path.

My expectation is that there should have been an error but not a traceback. Ideally, we should catch all errors and show a nice error message without showing any traceback/dump.

@nicholasyager nicholasyager self-assigned this Jul 18, 2023
@nicholasyager nicholasyager removed the triage Tis issue or pull request must be triaged by a project maintainer label Jul 18, 2023
@nicholasyager nicholasyager added this to the v0.4.1 milestone Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants