Access ADLS Gen2 files using R in Synapse notebooks

Sunil V R 6 Reputation points
2022-10-19T13:34:00.803+00:00

Hi,
Is there a way to access/read ADLS Gen2 files from Synapse notebooks using R ( I'm trying this with my notebook's language set to SparkR(R) )

The error and R code snippet are as below

Error -
1 "Error in file(file, \"rt\"): cannot open the connection\n----LIVY_END_OF_ERROR----"
Warning message:
In file(file, "rt") :
cannot open file 'abfss://<container-name>@<my-adls-account>.dfs.core.windows.net/ingested/housingstock_vacant_dwellings.csv': No such file or directory

R Code snippet -
vacantDwellings <- read.csv("abfss://<my-container>@<my-adlsstorage-account>.dfs.core.windows.net/ingested/housingstock_vacant_dwellings.csv")

* However I can access the files when using Python as my notebook language with the snippet below*
import pandas as pd
input_data=pd.read_csv('abfss://<my-container>@<my-adlsstorage-account>.dfs.core.windows.net/ingested/housingstock_vacant_dwellings.csv')

252053-errorusingr.png252063-successusingpython.png

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

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 91,656 Reputation points Moderator
    2022-10-20T08:31:08.607+00:00

    Hello @Sunil V R ,

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

    You cannot directly call the ADLS Gen2 endpoint, you may checkout the detailed steps Operations on an Azure Data Lake Storage Gen2 endpoint and AzureStor: an R package for working with Azure storage.

    Hope this helps.

    0 comments No comments

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.