cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
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!

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.