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

soda-dbt not working with dbt 1.8 #2175

Open
josedaniel-escribano-clarity opened this issue Sep 24, 2024 · 3 comments
Open

soda-dbt not working with dbt 1.8 #2175

josedaniel-escribano-clarity opened this issue Sep 24, 2024 · 3 comments

Comments

@josedaniel-escribano-clarity

Running the soda ingest dbt command with dbt 1.8 instead of dbt 1.7 makes the command throw the following exception:

soda ingest dbt -d snowflake -c configuration.yaml --dbt-artifacts /dbt_models/target/dbt_b2c-f763934-2944744/run_results.json
[15:25:30] Soda Library 1.1.27
[15:25:30] Soda Core 3.0.47
cannot import name 'RunResultOutput' from 'dbt.contracts.results' (/workspaces/b2c-consumer/.venv/lib/python3.10/site-packages/dbt/contracts/results.py)
Traceback (most recent call last):
  File "/workspaces/b2c-consumer/.venv/lib/python3.10/site-packages/soda/common/exception_helper.py", line 26, in invoke
    return super().invoke(ctx)
  File "/workspaces/b2c-consumer/.venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/workspaces/b2c-consumer/.venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/workspaces/b2c-consumer/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/workspaces/b2c-consumer/.venv/lib/python3.10/site-packages/soda/telemetry/soda_tracer.py", line 79, in wrapper
    raise e
  File "/workspaces/b2c-consumer/.venv/lib/python3.10/site-packages/soda/telemetry/soda_tracer.py", line 72, in wrapper
    result = fn(*original_args, **original_kwargs)
  File "/workspaces/b2c-consumer/.venv/lib/python3.10/site-packages/soda/cli/cli.py", line 624, in ingest
    from soda.cloud.dbt import DbtCloud
  File "/workspaces/b2c-consumer/.venv/lib/python3.10/site-packages/soda/cloud/dbt.py", line 20, in <module>
    from dbt.contracts.results import RunResultOutput
ImportError: cannot import name 'RunResultOutput' from 'dbt.contracts.results' (/workspaces/b2c-consumer/.venv/lib/python3.10/site-packages/dbt/contracts/results.py)
``
`
Using `soda-dbt` version `1.1.27`
@tools-soda
Copy link

CLOUD-8548

@jongracecox
Copy link

jongracecox commented Nov 8, 2024

In version 1.8 of dbt-core there was a PR (#9350) to move the RunResultOutput class into core/dbt/artifacts/run.py. An easy fix for this might be to use a try/except and import from the new location and fall back to the old location if not present (see below), however I did some testing and there are probably some other fixes that need to be made to get these versions compatible.

try:
    from dbt.artifacts.run import RunResultOutput
except ImportError:
    from dbt.contracts.results import RunResultOutput

@adkinsty
Copy link

adkinsty commented Feb 5, 2025

This was fixed in Soda Library v1.8.16: https://docs.soda.io/release-notes/all.html. I recommend you create a new python environment and try again following these instructions: https://docs.soda.io/soda/integrate-dbt.html#ingest-dbt-test-results-from-dbt-core-into-soda-cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants