安装了 dbt 并且工作正常,但是获取 db cmdlet,函数错误

Installed dbt and was working fine, but getting db cmdlet, function error

问题:安装了 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

系统和IDE:Windows10和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"
}

然后通过命令面板 Python 直接启动 python 到环境 Ext:

只需将您的 python路径调整为您的 .venvconda env 或首选 env 经理。