Databricks Workspace APIs

davide-maestron
New Contributor

Hello, I'm trying to collect metadata about the files stored in a Workspace Repo Folder, but it looks like the "size" field is always missing. The field is listed in a few SDKs (for example, in the Python documentation: https://databricks-sdk-py.readthedocs.io/en/latest/dbdataclasses/workspace.html#databricks.sdk.servi...), but even when using command line tools to invoke the API endpoint (like curl), no "size" is there in the json response.

Example of curl command line:

curl -H"Authorization: Bearer dapiXXXXX" "https://dbc-XXXX-XXX.cloud.databricks.com/api/2.0/workspace/get-status?path=%2FRepos%2F..."

Is that a bug on the server side? or is just a missing feature?

szymon_dybczak
Esteemed Contributor III

 

Hi @davide-maestron ,

Yep, it looks like a bug. According to docs, this attribute will be return only for files. 

szymon_dybczak_0-1755543613553.png

So I specifically provided a path to a file in my workspace and API didn't return size attribute:

szymon_dybczak_1-1755543650500.png

Edit: What's interesting is that documentation is saying that size attribute can be returned. I wonder what are the factors that cause this attribute to appear (if any) 😄



WiliamRosa
Databricks Partner

@szymon_dybczak, Help me understand if this makes sense: what if I use the Files API instead of the Workspace API to get the size?

Wiliam Rosa
Data Engineer | Machine Learning Engineer
LinkedIn: linkedin.com/in/wiliamrosa

szymon_dybczak
Esteemed Contributor III

Hi @WiliamRosa ,

Good idea, but unfortunately Files API doesn't support Workspace as a valid input to directory_path query parameter

szymon_dybczak_0-1755548272236.png