Skip to content

datalakefileclient.upload_data without overwrite #16166

Closed
@kasuteru

Description

It seems that I cannot use upload_data without setting the overwrite flag to true. Maybe I am doing something wrong:

file1 = my_file_system_client.get_file_client("path/to/NONEXISTING_file.txt")
file1.upload_data(data) # Trying to upload to a non-existing file
# Raises: azure.core.exceptions.ResourceNotFoundError: (PathNotFound) The specified path does not exist.

file1 = my_file_system_client.get_file_client("path/to/NONEXISTING_file.txt")
file1.upload_data(data, overwrite=True) # Trying to upload to a non-existing file, with overwrite
# Works!

file1 = my_file_system_client.get_file_client("path/to/existing.txt")
file1.upload_data(data) # Trying to upload to a existing file, without overwrite
# Raises: azure.storage.filedatalake._generated.models._models_py3.StorageErrorException: Operation returned an invalid status 'The condition specified using HTTP conditional header(s) is not met.'

file1 = my_file_system_client.get_file_client("path/to/existing.txt")
file1.upload_data(data, overwrite=True) # Trying to upload to a existing file, with overwrite
# Works!
 

If this is the case for everyone, I am questioning the use of the overwrite flag... or at least its default value of False?

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.Data Lake Storage Gen2Service AttentionWorkflow: This issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-author-feedbackWorkflow: More information is needed from author to address the issue.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions