Unable to write data in ADLS

Sukumar Vinnakota 66 Reputation points
2022-06-17T20:08:49.32+00:00

I used the code provided in the link (https://learn.microsoft.com/en-us/azure/synapse-analytics/spark/tutorial-spark-pool-filesystem-spec#readwrite-data-using-linked-service) for writing data from synapse workspace to ADLS Gen2.
I am getting an error with message "ValueError: Protocol not known: abfss" .Below is the code

import fsspec
import pandas

adls_account_name = '<<adlsName>>' #Provide exact ADLS account name

data = pandas.DataFrame({'Name':['Tom', 'nick', 'krish', 'jack'], 'Age':[20, 21, 19, 18]})
sas_key = TokenLibrary.getConnectionString('<<linkedServicePath>>')

fsspec_handle = fsspec.open('abfss://<<containerName>>/<<path>>', account_name =adls_account_name, sas_token=sas_key, mode="wt")

with fsspec_handle.open() as f:
data.to_csv(f)

Note: I am using FSSPEC to write the data as my spark pool has python version of 3.6.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
{count} votes

Answer accepted by question author
  1. PRADEEPCHEEKATLA 91,656 Reputation points Moderator
    2022-06-20T08:50:35.917+00:00

    Hello @Sukumar Vinnakota ,

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

    This is known limitation with pandas dataframe does not support the protocol - abfss.

    As per the repro, when I tried to pass the path as abfss - experiencing the same error message as shown above:

    212912-image.png

    When I tried to pass the path as abfs it's worked as excpeted.

    212922-image.png

    For more details, refer to the SO thread which addressing similar issue.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.