cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Using dbutils.fs.ls gives overlap error.

tototox
New Contributor III

I created a schema with that route as a managed location.

(abfss://~~@~~.dfs.core.windows.net/dejeong)

And an external table named 'first_table' was created in the corresponding path.

(abfss://~~@~~.dfs.core.windows.net/dejeong/first_table)

The results of the dbutils.fs.ls and sql list clauses are different for the three paths.

%python

dbutils.fs.ls("abfss://~~@~~.dfs.core.windows.net/dejeong") --> managed location overlaps error

dbutils.fs.ls("abfss://~~@~~.dfs.core.windows.net/dejeong/__unitystorage") --> managed location overlaps error

dbutils.fs.ls("abfss://~~@~~.dfs.core.windows.net/dejeong/first_table") --> out[3]

%sql

list"abfss://~~@~~.dfs.core.windows.net/dejeong" --> out[2]

list "abfss://~~@~~.dfs.core.windows.net/dejeong/__unitystorage" --> managed location overlaps error

list "abfss://~~@~~.dfs.core.windows.net/dejeong/first_table" -->out[2]

Is this a bug in dbutils.fs.ls?

Or did I do something wrong?

I want to navigate parent path with dbutils.fs.ls syntax.

3 REPLIES 3

Anonymous
Not applicable

@jin park​ :

It seems like there is an overlap in the path when you use dbutils.fs.ls() to list the contents of

abfss://~~@~~.dfs.core.windows.net/dejeong, which is the managed location. This may be due to the fact that the managed location is also a path, and this is causing a conflict. To navigate to the parent path, you can use dbutils.fs.ls("abfss://~~@~~.dfs.core.windows.net/dejeong/"), with a trailing slash at the end of the path. This should list the contents of the parent directory without causing any conflicts.

Alternatively, you can try using dbutils.fs.ls("abfss://~~@~~.dfs.core.windows.net/dejeong/__internal")

, which is the internal directory where managed tables are stored, instead of __unitystorage.

It's also worth noting that the behavior of dbutils.fs.ls() and list in SQL may differ, as they are different methods and may handle paths differently.

tototox
New Contributor III

dbutils.fs.ls("abfss://~~@~~.dfs.core.windows.net/dejeong/ ")

This route still gives me an error

Anonymous
Not applicable

Hi @jin park​ 

Hope everything is going great.

Just wanted to check in if you were able to resolve your issue. If yes, would you be happy to mark an answer as best so that other members can find the solution more quickly? If not, please tell us so we can help you. 

Cheers!

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group