AzureFileDatastore Class
Represents a datastore that saves connection information to Azure File storage.
You should not work with this class directly. To create a datastore of this type, use the register_azure_file_share method of Datastore.
Note: When using a datastore to access data, you must have permission to access that data, which depends on the credentials registered with the datastore.
Initialize a new Azure File Share Datastore.
- Inheritance
-
AzureFileDatastore
Constructor
AzureFileDatastore(workspace, name, container_name, account_name, sas_token=None, account_key=None, protocol=None, endpoint='core.windows.net', request_session=None)
Parameters
Name | Description |
---|---|
workspace
Required
|
The workspace this datastore belongs to. |
name
Required
|
The name of the datastore. It can only contain alphanumeric characters or - or _. |
container_name
Required
|
The file share name |
account_name
Required
|
The storage account name |
sas_token
|
str, <xref:optional>
The SAS token for accessing this container. The default is None. default value: None
|
account_key
|
str, <xref:optional>
The storage account key. The default is None. default value: None
|
protocol
|
str, <xref:optional>
The protocol to use to connect to the storage account. If None, defaults to https. default value: None
|
endpoint
|
str, <xref:optional>
The endpoint of the blob container. If None, defaults to core.windows.net. default value: core.windows.net
|
request_session
|
<xref:requests.sessions.Session>, <xref:optional>
The session object to use for http requests. The default is None. default value: None
|
workspace
Required
|
The workspace this datastore belongs to. |
name
Required
|
The name of the datastore. It can only contain alphanumeric characters or - or _. |
container_name
Required
|
The file share name |
account_name
Required
|
The storage account name |
sas_token
Required
|
str, <xref:optional>
The SAS token for accessing this container. The default is None. |
account_key
Required
|
str, <xref:optional>
The storage account key. The default is None. |
protocol
Required
|
str, <xref:optional>
The protocol to use to connect to the storage account. If None, defaults to https. |
endpoint
Required
|
str, <xref:optional>
The endpoint of the blob container. If None, defaults to core.windows.net. |
request_session
Required
|
<xref:requests.sessions.Session>, <xref:optional>
The session object to use for http requests. The default is None. |
Methods
download |
Download the data from the file share to the local file system. |
upload |
Upload the data from the local file system to the file share this datastore points to. Note: For this method to work, the datastore object must have either account key or SAS
token property populated. If datastore object doesn't contain any form of credential, this
method will fail.
Moreover, this method has been deprecated, may be removed in future. We suggest that you use
the |
upload_files |
Upload the data from the local file system to the file share this datastore points to. Note: This method is deprecated and will no longer be supported. Recommend to use
|
download
Download the data from the file share to the local file system.
download(target_path, prefix=None, overwrite=False, show_progress=True)
Parameters
Name | Description |
---|---|
target_path
Required
|
The local directory to download the file to. |
prefix
|
str, <xref:optional>
The path to the folder in the file share to download. If set to None, Azure Machine Learning will download everything in the file share. default value: None
|
overwrite
|
bool, <xref:optional>
Indicates whether to overwrite existing file. default value: False
|
show_progress
|
bool, <xref:optional>
Indicates whether to show the progress of download in the console. default value: True
|
Returns
Type | Description |
---|---|
The number of files successfully downloaded. |
upload
Upload the data from the local file system to the file share this datastore points to.
Note: For this method to work, the datastore object must have either account key or SAS
token property populated. If datastore object doesn't contain any form of credential, this
method will fail.
Moreover, this method has been deprecated, may be removed in future. We suggest that you use
the Dataset.File.upload_directory
method to upload your files from local directory and
create FileDataset in a single method call.
upload(src_dir, target_path=None, overwrite=False, show_progress=True)
Parameters
Name | Description |
---|---|
src_dir
Required
|
The local directory to upload. |
target_path
Required
|
The location in file share to upload to. If None then upload to root. |
overwrite
Required
|
bool, <xref:optional>
Indicates whether to overwrite existing files. |
show_progress
Required
|
bool, <xref:optional>
Indicates whether to show the progress of upload in the console. |
Returns
Type | Description |
---|---|
The DataReference instance for the target path uploaded. |
upload_files
Upload the data from the local file system to the file share this datastore points to.
Note: This method is deprecated and will no longer be supported. Recommend to use
FileDatasetFactory.upload_directory
instead.
upload_files(files, relative_root=None, target_path=None, overwrite=False, show_progress=True)
Parameters
Name | Description |
---|---|
files
Required
|
A list of absolute path to files to upload. |
relative_root
Required
|
str, <xref:optional>
The base path used to determine the path
of the files in the file share. For example, if you upload /path/to/file.txt, and you define
base path to be /path, when file.txt is uploaded to the file share, it will have
the path of /to/file.txt. If |
target_path
Required
|
str, <xref:optional>
The location in the file share to upload the data to. The default is None, the root. |
overwrite
Required
|
bool, <xref:optional>
Indicates whether to overwrite existing files. |
show_progress
Required
|
bool, <xref:optional>
Indicates whether to show the progress of upload in the console. |
Returns
Type | Description |
---|---|
The DataReference instance for the target path uploaded. |
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for