Problem
You previously exported a DBC file using the Databricks REST API (AWS | Azure | GCP). When you try to import that same DBC file into your Databricks workspace you get an invalid parameter value error message.
INVALID_PARAMETER_VALUE: The dbc file may not be valid or may be an unsupported version.
Info
This can occur when using either the DBC
or Auto
format for when importing and exporting files or notebooks.
Cause
You are missing the direct_download
parameter when using the API to export. By default, the export API returns a JSON object with base64-encoded content. This is not valid for DBC files. When the direct_download
parameter is set to true
, the API call returns the raw DBC file, without encoding it.
Solution
You should always use "direct_download": "true"
when exporting files or notebooks via the API.
Example code
%sh
curl -X POST \
https://<databricks-instance>/api/2.0/workspace/export \
-H "Authorization: Bearer <your-access-token>" \
-H "Content-Type: application/json" \
-d '{
"path": "<path-to-your-notebook-or-directory>",
"format": "AUTO",
"direct_download": "true"
}'
Re-export the DBC file using the updated API call.
Import the newly exported DBC file to verify it is working correctly.
Info
To avoid similar issues in the future, always ensure the direct_download
parameter is set to true
when exporting files using the API.