runtime-error - 安装了 dbt 并且工作正常,但是获取 db cmdlet,功能错误

标签 runtime-error dbt

问题:安装了 dbt 并创建了一个项目,定义了模型并运行了一些测试。现在执行 dbt 时出现此错误。

dbt : The term 'dbt' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • dbt run -m eve-source
  •   + CategoryInfo          : ObjectNotFound: (dbt:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

系统和 IDE:Windows 10 和 VSCode Python版本:3.7.3

dbt 在 Powershell 提示符下工作正常,但我希望它也能与 VSCode 一起使用。请在这件事上给予我帮助。谢谢。

最佳答案

对于 dbtvscode 工作流程,我使用以下安装:


应用:

  • VS 代码 v1.49.0

扩展:

项目目录:

  project_dbt
      | .vscode
      |  > dbt.code-workspace
      |  > settings.json
      | analysis
      | macros
      | models
      | seed
      | tests
      | .gitignore
      | dbt_project.yml
      | packages.yml
      | Readme.md

其中dbt.code-workspace内容是:

{
    "folders": [
        {
            "path": ".."
        }
    ],
    "settings": {}
}

settings.json内容是:

{
    "python.pythonPath": "C:\\tools\\miniconda3\\envs\\dbt\\python.exe"
}

然后通过 Command Palette Python Ext 直接将 python 启动到环境中: enter image description here

只需将 pythonPath 调整为您的 .venvconda env 或首选 env 管理器即可。

关于runtime-error - 安装了 dbt 并且工作正常,但是获取 db cmdlet,功能错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63607851/

相关文章:

C 内存分配错误

excel - XLSB 个人宏文件变量错误

angular - 由于内存问题,compodoc 未生成图形

python - 教程生成信号量问题的 dbt 调试

vba - 检测对象是否已与其客户端断开连接

从 <sys/stat.h> 调用 stat 失败并出现 "Value too large for defined data type"错误

list - 如何在 dbt jinja 中将两个表连接到字典中

sql - dbt 与多个 unique_keys 合并如何使用 jinja 引用唯一键?

database - dbt 快照失败(错误 : 100090 (42P18): Duplicate row detected during DML action)

dbt - 我们如何在 SCD 1 实现的增量模型中使用合并语句