You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows环境下DBT传递--vars参数时出现未识别参数错误

解决dbt运行时传入--vars参数报错的问题

你的报错核心是shell对引号的解析错误,你命令里用的"是HTML转义的双引号,shell无法识别,导致原本的JSON被拆分成多个零散参数,dbt因此报“无法识别的参数”。

正确的命令写法(分shell环境)

1. Unix/Linux/macOS的bash/zsh等shell

直接用单引号包裹整个JSON字符串,内部使用普通双引号:

dbt parse --profiles-dir . --target dev --vars '{"client_name": "ecc6_test_client","fiscal_start_month_number": "3","fiscal_year": "2020"}'

如果需要在JSON里使用单引号,也可以用双引号包裹整个JSON,内部双引号加反斜杠转义:

dbt parse --profiles-dir . --target dev --vars "{\"client_name\": \"ecc6_test_client\",\"fiscal_start_month_number\": \"3\",\"fiscal_year\": \"2020\"}"

2. Windows的cmd命令行

cmd对引号的处理逻辑不同,需要把内部的双引号替换成两个双引号:

dbt parse --profiles-dir . --target dev --vars "{""client_name"": ""ecc6_test_client"",""fiscal_start_month_number"": ""3"",""fiscal_year"": ""2020""}"

验证方法

可以先打印出--vars的内容,确认shell解析后是完整的JSON:

echo '{"client_name": "ecc6_test_client","fiscal_start_month_number": "3","fiscal_year": "2020"}'

输出应为完整、未被拆分的JSON字符串,说明写法正确。

内容的提问来源于stack exchange,提问作者Lambo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 17:30:57