Skip to content

Commit 3d3742d

Browse files
author
Larry Franks
committed
incorporating feedback
1 parent 4ef364b commit 3d3742d

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

articles/machine-learning/how-to-share-data-across-workspaces-with-registries.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,16 @@ az ml data create -f local-folder.yml
356356
357357
For more information on creating data assets in a workspace, see [How to create data assets](how-to-create-data-assets.md).
358358
359-
The data asset created in the workspace can be shared to a registry. From the registry, it can be used in multiple workspaces. You can also change the name and version when sharing the data from workspace to registry.
359+
The data asset created in the workspace can be shared to a registry. From the registry, it can be used in multiple workspaces. You can also change the name and version when sharing the data from workspace to registry. Sharing a data asset from a workspace to a registry uses the `--path` parameter to reference the data asset to be shared. Valid path formats are:
360+
361+
* `azureml://subscriptions/<subscription-id>/resourcegroup/<resource-group-name>/data/<data-asset-name>/versions/<version-number>`
362+
* `azureml://resourcegroup/<resource-group-name>/data/<data-asset-name>/versions/<version-number>`
363+
* `azureml://data/<data-asset-name>/versions/<version-number>`
364+
365+
The following example demonstrates using the `--path` parameter to share a data asset. Replace `<registry-name>` with the name of the registry that the data will be shared to. Replace `<resourceGroupName>` with the name of the resource group that contains the Azure Machine Learning workspace where the data asset is registered:
360366
361367
```azurecli
362-
az ml data share --name local-folder-example-titanic --version 1 --registry-name <registry-name> --share-with-name <new-name> --share-with-version <new-version>
368+
az ml data create --registry-name <registry-name> --path azureml://resourcegroup/<resourceGroupName>/data/local-folder-example-titanic/versions/1
363369
```
364370
365371
# [Python SDK](#tab/python)
@@ -382,8 +388,19 @@ For more information on creating data assets in a workspace, see [How to create
382388
The data asset created in workspace can be shared to a registry and it can be used in multiple workspaces from there. You can also change the name and version when sharing the data from workspace to registry.
383389
384390
```python
385-
ml_client.models.share(name="titanic-dataset", version=1, registry_name=<registry_name>, share_with_name=<new-name>, share_with_version=<new-version>)
391+
# Fetch the data from the workspace
392+
data_in_workspace = ml_client_workspace.data.get(name="titanic-dataset", version="1")
393+
print("data from workspace:\n\n", data_in_workspace)
394+
395+
# Change the format to one that the registry understands:
396+
# Note the asset ID when printing the `data_ready_to_copy` object.
397+
data_ready_to_copy = ml_client_workspace.data._prepare_to_copy(data_in_workspace)
398+
print("\n\ndata ready to copy:\n\n", data_ready_to_copy)
399+
400+
# Copy the data from the workspace to the registry
401+
ml_client_registry.data.create_or_update(data_ready_to_copy).wait()
386402
```
403+
387404
---
388405
389406

0 commit comments

Comments
 (0)