Synapse工作区上传包

huangapple go评论74阅读模式
英文:

Synapse workspace upload package

问题

我们已经建立了一个通过Azure命令将库/包上传到Synapse工作区的流程。

az synapse workspace-package upload --workspace-name testsw --package C:/python.whl

我尝试追加 --overwrite 以覆盖现有的库,但它报错了。
在Synapse工作区中,我们有没有任何命令可以覆盖现有的包?

编辑:
当我追加 --overwrite 时,我收到的错误如下:

未识别的参数:--overwrite

英文:

We have set up a pipeline to upload the libraries/packages to synpase workspace using Azure commands

az synapse workspace-package upload --workspace-name testsw --package C:/python.whl

I tried appending --overwrite just to overwrite the existing library but it threw error.
Do we have any command to overwrite the existing package in Synapse Workspace?

Edit:
Error I got while I appended --overwrite is as below:

Unrecognized arguments : --overwrite

答案1

得分: 1

在az命令中没有像 --overwrite 这样的选项,但您可以检查包是否存在。如果存在,则删除并上传新包。

以下是执行此操作的命令。

$workspaceName = "workspace_name"
$packageName = "package_name"
$packageFilePath = "curr_package_name"

$packageExists = az synapse workspace-package show --workspace-name $workspaceName --name $packageName --query "id" -o tsv

if ($packageExists) {
    az synapse workspace-package delete --workspace-name $workspaceName --name $packageName --yes
}
az synapse workspace-package upload --workspace-name $workspaceName --package $packageFilePath

Synapse工作区上传包

英文:

There is no option like --overwrite in az command, but what you can do is check if package exists.
If exists delete and upload new one.

Below are the commands for that.

$workspaceName = "workspace_name"
$packageName = "package_name"
$packageFilePath = "curr_package_name"

$packageExists = az synapse workspace-package show --workspace-name $workspaceName --name $packageName --query "id" -o tsv

if ($packageExists) {
az synapse workspace-package delete --workspace-name $workspaceName --name $packageName --yes
}
az synapse workspace-package upload --workspace-name $workspaceName --package $packageFilePath

Synapse工作区上传包

答案2

得分: 0

我已经能够通过@JayashankarGS提供的答案解决了这个问题。
我做了一个小小的改变:

$workspaceName = "workspace_name"
$packageName = "package_name"
$packageFilePath = "curr_package_name"

$packageExists = az synapse workspace-package show --workspace-name $workspaceName --name $packageName --query "id" -o tsv

if ($packageExists -eq $null) {
az synapse workspace-package upload --workspace-name $workspaceName --package $packageFilePath
}

我在删除现有的whl文件时出现错误的原因是,在Synapse中,whl文件正在被某个管道使用。

英文:

I was able to fix the issue with the answer provided by @JayashankarGS
A slight change I have made:

> $workspaceName = "workspace_name"
> $packageName = "package_name"
> $packageFilePath = "curr_package_name"
>
> $packageExists = az synapse workspace-package show --workspace-name $workspaceName --name $packageName --query "id" -o tsv
>
> if ($packageExists -eq $null) {
> az synapse workspace-package upload --workspace-name $workspaceName --package $packageFilePath
> }

The reason why I was getting error while deleting the existing whl file was , in Synapse the whl file was being used by some pipeline

huangapple
  • 本文由 发表于 2023年7月20日 20:45:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76730044.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定