Databricks icon

Databricks

Interact with Databricks API

Overview

The Databricks node allows users to interact with the Databricks API, specifically supporting multiple resources including Databricks SQL. The Execute Query operation under the Databricks SQL resource enables running arbitrary SQL queries on a specified SQL warehouse (also called a SQL endpoint or cluster) within Databricks.

This operation is useful for scenarios such as:

  • Retrieving data from tables in Databricks for further processing or analysis.
  • Running custom SQL commands to transform or aggregate data inside Databricks.
  • Integrating Databricks SQL query results into automated workflows, dashboards, or reports.

For example, you could use this node to run a query like SELECT * FROM sales_data LIMIT 100 on a specific SQL warehouse and then pass the results downstream in your workflow for visualization or alerting.

Properties

Name Meaning
Warehouse ID The ID of the SQL warehouse (SQL endpoint) where the query will be executed.
Query The SQL query string to execute.
Additional Fields Optional parameters:
• Catalog: The catalog to use for the query.
• Schema: The schema to use.
• Timeout: Query timeout in seconds (default 60).

Output

The output of the Execute Query operation is an array of JSON objects representing the rows returned by the SQL query. Each item corresponds to one row, with key-value pairs matching the column names and their values.

If the query returns no rows, the output will be an empty array.

The node does not output binary data for this operation; all results are provided as structured JSON.

Dependencies

  • Requires an API authentication token credential for Databricks with appropriate permissions to access the SQL warehouse and execute queries.
  • The node uses the Databricks REST API endpoint configured via credentials (host URL and bearer token).
  • No additional external dependencies beyond the Databricks API and n8n's HTTP request capabilities.

Troubleshooting

  • Common issues:

    • Invalid or expired API token: The node will fail to authenticate with Databricks.
    • Incorrect Warehouse ID: If the warehouse ID does not exist or is not accessible, the query will fail.
    • SQL syntax errors: Malformed SQL queries will cause the API to return errors.
    • Timeout exceeded: Queries taking longer than the specified timeout may be aborted.
  • Error messages:

    • API Error: <status code> <status text>: Indicates an error response from the Databricks API. Check the status code and message for details (e.g., 401 Unauthorized, 404 Not Found).
    • Network Error: No response received from server: Indicates connectivity issues or incorrect host configuration.
    • Detailed error information is included in the output if "Continue On Fail" is enabled, otherwise the node execution stops with the error.
  • Resolution tips:

    • Verify API credentials and permissions.
    • Confirm the Warehouse ID is correct and active.
    • Test SQL queries directly in Databricks SQL editor before using them in the node.
    • Adjust the timeout setting if queries take longer to complete.

Links and References

Discussion