首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >RuntimeException:运行时错误无法运行dbt

RuntimeException:运行时错误无法运行dbt
EN

Stack Overflow用户
提问于 2022-09-24 21:52:50
回答 1查看 191关注 0票数 0

我使用dbt init在我的.dbt文件夹中创建了一个profiles.yml。看起来是这样的:

代码语言:javascript
运行
复制
spring_project:
  outputs:
    dev:
      account: xxx.snowflakecomputing.com
      database: PROD_DWH
      password: password
      role: SYSADMIN
      schema: STG
      threads: 1
      type: snowflake
      user: MYUSERNAME
      warehouse: DEV_XS_WH
  target: dev

现在,我在桌面上创建了一个新文件夹,它只包含一个包含以下内容的dbt_project.yml文件:

代码语言:javascript
运行
复制
profile: 'spring_project'

当我从我的项目文件夹运行这个项目时:

代码语言:javascript
运行
复制
dbt debug --config-dir

我明白了:

代码语言:javascript
运行
复制
21:48:59  Running with dbt=1.2.1
21:48:59  To view your profiles.yml file, run:

open /Users/myusername/.dbt

但是,当我运行dbt时

代码语言:javascript
运行
复制
dbt run --profiles-dir /Users/myusername/.dbt

我明白了:

代码语言:javascript
运行
复制
21:43:39  Encountered an error while reading the project:
21:43:39    ERROR: Runtime Error
  Invalid config version: 1, expected 2

Error encountered in /Users/myusername/Desktop/spring_project/dbt_project.yml
21:43:39  Encountered an error:
Runtime Error
  Could not run dbt
21:43:39  Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/dbt/task/base.py", line 108, in from_args
    config = cls.ConfigType.from_args(args)
  File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/runtime.py", line 226, in from_args
    project, profile = cls.collect_parts(args)
  File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/runtime.py", line 194, in collect_parts
    partial = Project.partial_load(project_root, verify_version=version_check)
  File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/project.py", line 639, in partial_load
    return PartialProject.from_project_root(
  File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/project.py", line 485, in from_project_root
    raise DbtProjectError(
dbt.exceptions.DbtProjectError: Runtime Error
  Invalid config version: 1, expected 2

Error encountered in /Users/myusername/Desktop/spring_project/dbt_project.yml

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/dbt/main.py", line 129, in main
    results, succeeded = handle_and_check(args)
  File "/opt/homebrew/lib/python3.10/site-packages/dbt/main.py", line 191, in handle_and_check
    task, res = run_from_args(parsed)
  File "/opt/homebrew/lib/python3.10/site-packages/dbt/main.py", line 218, in run_from_args
    task = parsed.cls.from_args(args=parsed)
  File "/opt/homebrew/lib/python3.10/site-packages/dbt/task/base.py", line 185, in from_args
    return super().from_args(args)
  File "/opt/homebrew/lib/python3.10/site-packages/dbt/task/base.py", line 114, in from_args
    raise dbt.exceptions.RuntimeException("Could not run dbt") from exc
dbt.exceptions.RuntimeException: Runtime Error
  Could not run dbt

我做错了什么?

EN

回答 1

Stack Overflow用户

发布于 2022-09-25 06:41:21

最可能的原因是缺乏config-version

dbt.exceptions.DbtProjectError:运行时错误配置版本: 1,预期为2

配置-版本

配置-版本:2 将dbt_project.yml指定为使用v2结构。 默认值: 如果没有此配置,dbt将假设您的使用版本1语法,在DBTv0.19.0.中不推荐使用该语法。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73840806

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档