问题:安装了 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 一起使用。请在这件事上给予我帮助。谢谢。
最佳答案
对于 dbt
和 vscode
工作流程,我使用以下安装:
应用:
- 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 启动到环境中:
只需将 pythonPath 调整为您的 .venv
、conda env
或首选 env
管理器即可。
关于runtime-error - 安装了 dbt 并且工作正常,但是获取 db cmdlet,功能错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63607851/