Search code examples
pythonazure-data-lakeazure-synapse

Why do i get "the specified blob doesn't exist" only when I try to write to it?


I am trying to write to a .csv file in an azure container using a notebook in my Synapse workspace. I can read a test file I have placed there:

reading the csv is correct

However, when I try to write to exactly the same path (with a changed filename) I get the error "HTTPError: HTTP Error 404: The specified blob does not exist."

"The specified blob does not exist " error

blob doesn't exist error

The path I am using is: https://{ACCOUNTNAME}.blob.core.windows.net/{CONTAINER}/{FOLDER}/{FILENAME}.csv


Solution

  • Please follow the storage account syntax : abfss://<container_name>@<storage_account>.dfs.core.windows.net/<folder_name>

    I reproduce the same in the environment got this output.

    Writing CSV files from ADLS.

    Code:

    #write csv file
    import pandas
    df1 = pandas.DataFrame(
    {
    'Name':['A', 'B', 'C', 'D'],
    'ID':[90, 80, 95, 20]
    })
    
    df1.to_csv('abfss://<container_name>@<storage_account>.dfs.core.windows.net/<folder_name>')
    

    enter image description here