Databricks icon

Databricks

Interact with Databricks API

Overview

This node interacts with the Databricks API to manage files within the Unity Catalog environment. Specifically, the Create Directory operation under the Files resource allows users to create new directories (folders) inside a specified volume of a Unity Catalog schema. This is useful for organizing data storage hierarchically in Databricks file systems.

Typical use cases include:

  • Automating the creation of directory structures before uploading or managing files.
  • Organizing datasets by project, date, or other criteria within Databricks volumes.
  • Preparing folder paths dynamically as part of ETL workflows or data pipeline setups.

For example, you might create a directory named projectA/raw_data inside a specific volume to store raw input files for processing.

Properties

Name Meaning
Catalog Selects the Unity Catalog to access files from.
Schema Selects the schema within the chosen catalog.
Volume Selects the volume within the chosen catalog and schema where the directory will be created.
Directory Name The name (and optionally path) of the directory to create, e.g., "folder1" or "folder1/subfolder".

The first three properties (Catalog, Schema, Volume) are dropdown options dynamically loaded from the Databricks API based on previous selections, ensuring valid hierarchical selection.

Output

The output JSON contains a success confirmation message indicating that the directory was created successfully. The structure is:

{
  "success": true,
  "message": "File uploaded successfully to <path>"
}

(Note: The provided bundled code snippet does not explicitly show a separate response for directory creation, but based on the pattern for file upload and typical API behavior, a similar success message would be expected.)

No binary data output is involved in this operation.

Dependencies

  • Requires an active Databricks account with appropriate permissions to access Unity Catalog resources.
  • Needs an API authentication token credential configured in n8n to authorize requests.
  • The node dynamically fetches available catalogs, schemas, and volumes via Databricks REST API endpoints.
  • Network connectivity to the Databricks workspace URL specified in credentials.

Troubleshooting

  • Common Issues:

    • Invalid or missing API token: Ensure the API key/token credential is correctly set up and has sufficient privileges.
    • Incorrect catalog/schema/volume selection: The dropdowns depend on prior selections; if no options appear, verify your Databricks environment and permissions.
    • Directory already exists: The API may return an error if trying to create a directory that already exists.
    • Network errors: Check internet connectivity and firewall settings allowing access to Databricks API endpoints.
  • Error Messages:

    • API Error: <status> <statusText>: Indicates a problem with the request or authorization. Review the status code and message for details.
    • Network Error: No response received from server: Suggests connectivity issues or incorrect base URL.
    • Other generic errors will be logged with stack traces if continueOnFail is disabled.

To resolve errors, verify credentials, check API endpoint URLs, and ensure the directory path is valid and does not conflict with existing folders.

Links and References


Note: This summary is based solely on static analysis of the provided source code and property definitions without runtime execution.

Discussion