List content of a directory in Spark code in Azure Synapse
Asked Answered
P

1

6

In Databricks' Scala language, the command dbutils.fs.ls lists the content of a directory. However, I'm working on a notebook in Azure Synapse and it doesn't have dbutils package. What is a Spark command corresponding to dbutils.fs.ls?

%%scala
  dbutils.fs.ls("abfss://[email protected]/outputs/wrangleddata")
%%spark
  // list the content of a directory. ????
Pharyngitis answered 27/5, 2021 at 21:45 Comment(0)
S
12

Just use mssparkutils, it's a rough equivalent and the main documentation page is here. A simple example:

mssparkutils.fs.ls("/")
mssparkutils.fs.ls("abfss://[email protected]/outputs/wrangleddata")
Shipshape answered 28/5, 2021 at 9:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.