Search code examples
azureazure-synapseazure-cli

Synapse workspace upload package


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


Solution

  • 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