Skip to content

Commit e92b8f8

Browse files
author
fkriti
committed
updated the syntax to share data from ws to reg
1 parent 43effca commit e92b8f8

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

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

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,12 @@ 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. 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:
359+
The data asset created in the workspace can be shared to a registry. From the registry, it can be used in multiple workspaces. Note that we are passing `--share_with_name` and `--share_with_version` parameter in share function. These parameters are optional and if you do not pass these data will be shared with same name and version as in workspace.
360360
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:
361+
The following example demonstrates using share command to share a data asset. Replace `<registry-name>` with the name of the registry that the data will be shared to.
366362
367363
```azurecli
368-
az ml data create --registry-name <registry-name> --path azureml://resourcegroup/<resourceGroupName>/data/local-folder-example-titanic/versions/1
364+
az ml data share --name local-folder-example-titanic --version <version-in-workspace> --share-with-name <name-in-registry> --share-with-version <version-in-registry> --registry-name <registry-name>
369365
```
370366
371367
# [Python SDK](#tab/python)
@@ -387,18 +383,17 @@ For more information on creating data assets in a workspace, see [How to create
387383
388384
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.
389385
390-
```python
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)
386+
Note that we are passing `share_with_name` and `share_with_version` parameter in share function. These parameters are optional and if you do not pass these data will be shared with same name and version as in workspace.
399387
400-
# Copy the data from the workspace to the registry
401-
ml_client_registry.data.create_or_update(data_ready_to_copy).wait()
388+
```python
389+
# Sharing data from workspace to registry
390+
ml_client_workspace.data.share(
391+
name="titanic-dataset",
392+
version="1",
393+
registry_name="<REGISTRY_NAME>",
394+
share_with_name=<name-in-registry>,
395+
share_with_version=<version-in-registry>,
396+
)
402397
```
403398
404399
---

0 commit comments

Comments
 (0)