Databricks

Learn how to use the Databricks node in StackAI to run analytics and machine learning queries. See required inputs, configurations, and output examples.

What is Databricks?

The Databricks node in StackAI allows you to query a Databricks workspace for data analytics and machine learning. It translates plain English or SQL queries into actionable database operations, returning both the executed SQL and the results.


How to use it?

  1. Add the Databricks node to your StackAI workflow.

  2. Provide the required database schema and your query (in plain English or SQL).

  3. Connect the node to downstream nodes to process or display the results.


Example of Usage

Suppose you want to find the total revenue for 2024 from your sales table:

  • Schema Example:

    TABLE Sales (OrderID INT, Customer STRING, Revenue DOUBLE, Year INT);
  • Query Example:

    What is the total revenue for the year 2024?

Available Actions

1. Query a Databricks Workspace

Description: Run analytics or machine learning queries on your Databricks database using natural language or SQL.

Inputs

  • Schema (sql_schema)

    • Type: Array of strings (textarea)

    • Required: Yes

    • Description: The database schema, including tables, columns, and types.

    • Example:

      TABLE Sales (OrderID INT, Customer STRING, Revenue DOUBLE, Year INT);
  • Query (query)

    • Type: String

    • Required: Yes

    • Description: The question or command you want to run, in plain English or SQL.

    • Example:

      What is the total revenue for the year 2024?

Configurations

  • No additional configurations are required for this action.

Outputs

  • Query (sql_query)

    • Type: String

    • Required: Yes

    • Description: The SQL query that was executed.

    • Example:

      SELECT SUM(Revenue) FROM Sales WHERE Year = 2024;
  • Results (results)

    • Type: Array of objects

    • Required: Yes

    • Description: The results returned from the Databricks query.

    • Example:

      [
        { "SUM(Revenue)": 1250000 }
      ]

Summary Table

Field
Type
Required
Description
Example

sql_schema

Array of strings

Yes

Database schema (tables, columns, types, etc.)

TABLE Sales (OrderID INT, Revenue DOUBLE);

query

String

Yes

Query in plain English or SQL

What is the total revenue for 2024?

sql_query

String

Yes

The SQL query that was executed

SELECT SUM(Revenue) FROM Sales WHERE ...

results

Array of objects

Yes

Results of the Databricks query

[{ "SUM(Revenue)": 1250000 }]


Best Practices

  • Always provide a clear and complete schema for accurate query translation.

  • Use natural language for ease, or SQL for precision.

  • Review the returned SQL to ensure it matches your intent.


Use the Databricks node in StackAI to seamlessly integrate advanced analytics and machine learning queries into your automated workflows.

Last updated

Was this helpful?