skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. 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
    

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search