question

HamsiniS-9867 avatar image
0 Votes"
HamsiniS-9867 asked PRADEEPCHEEKATLA-MSFT commented

Not able to Overwrite the file in Storage File Data Lake through API

Hi there,

I am trying to use upload_data() function to overwrite a file in ADLS GEN2 storage file share. But it is throwing me error as below.

Below are the imported libraries
from azure.storage.filedatalake import DataLakeServiceClient
from azure.identity import ClientSecretCredential

Below is the piece of code trying to over write
file_client = datalake_service.get_file_client(file_system="c/Property",file_path="cities1.txt")
local_file = open("new.csv",'r')
file_contents = local_file.read()
file_client.upload_data(file_contents, overwrite=False)

Error received
HttpResponseError: (ConditionNotMet) The condition specified using HTTP conditional header(s) is not met.
RequestId:1585fe0d-@@@@@@@@@
Time:2021-05-24T15:41:47.6732655Z
Code: ConditionNotMet
Message: The condition specified using HTTP conditional header(s) is not met.
RequestId:1585fe0d@@@@@@@@@@
Time:2021-05-24T15:41:47.6732655Z

Please help me to solve this issue.

Thanks,

azure-storage-accountsazure-data-lake-storage
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @HamsiniS-9867,

Thanks for the question and using MS Q&A platform.

It's hard to resolve the issue without the complete logs of the error message.

Cloud you please implement logging with your DataLakeFileClient to get the detailed errors: https://docs.microsoft.com/en-us/azure/developer/python/sdk/storage/storage-file-datalake-readme?view=storage-py-v12#logging

Meanwhile, you may check out how to use Python to manage directories and files in Azure Data Lake Storage Gen2.


0 Votes 0 ·

Hello @HamsiniS-9867,

Just checking in if you have had a chance to see the previous response. We need the following information to understand/investigate this issue further.

0 Votes 0 ·

0 Answers