TypeError when creating Data Asset with Python

Marvin Joseph Guico Agor 67 Reputation points
2023-05-26T12:30:54.4566667+00:00

I'm trying to register data from a datastore programatically (via Python SDK v2). I need to do it this way since the final output will be a scheduled AzureML Pipeline that does preprocessing for an NLP module. Further, as time progresses, the source files will also be updated. I'm attempting to run the following script:

from azure.ai.ml.entities  import Data
from azure.ai.ml.constants import AssetTypes

data_path = "azureml://
/datastores/[name-of-datastore]/paths/[filename].csv
"


data_asset = Data(
    path = data_path,
    type = AssetTypes.URI_FILE,
    description= 'description',
    name = 'data_name'
)

ml_client.data.create_or_update(asset)



However, running that prompts me with the error

TypeError: Please refer to create_or_update docstring for valid input types.

I'm not sure why I'm getting this error and would like to ask for all the help I can get.

While the example shows an excel file, I have more files I wish to register this way, some being excel sheets.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,551 questions
{count} votes