Synapse Create-运行powershell错误,带有json参数输入

问题描述 投票:0回答:1
$datasourceprefix = "abc"
az synapse pipeline create-run --workspace-name $workspaceName --name "L_Create_Views" --parameters '{\"data_source\": [\"'+$datasourceprefix+'\"]}'

我正在尝试使用上述命令创建一个突触管道运行,但由于参数输入 json 而失败。

错误:

如有任何建议,我们将不胜感激。

powershell azure-cli apache-synapse
1个回答
0
投票
Failed to parse string as JSON:
    {"data_source": ["++"]}
Error detail: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
The provided JSON string may have been parsed by the shell. See https://docs.microsoft.com/cli/azure/use-cli-effectively#use-quotation-marks-in-arguments

这是 JSON 解析的问题,特别是

$datasourceprefix
的值。该错误表明它未正确解释为 JSON。所以你可以使用下面的代码:

$datasourceprefix = "abc"
az synapse pipeline create-run --workspace-name <workspaceName> --name "<pipelineName>" --parameters "{\"data_source\": [\"$datasourceprefix\"]}"

它将成功运行管道,如下所示:

Enter image description here

Enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.