Databricks icon

Databricks

Interact with Databricks API

Unity Catalog → Create Function

AI-generated

Overview

This node operation creates a new function within the Unity Catalog in Databricks. It is useful for users who want to define custom functions in their data catalog schemas to extend data processing capabilities. For example, a user can create a SQL function with specified input parameters and return type to be used in queries within the Unity Catalog environment.

Use Case Examples

  1. Creating a SQL function named 'my_function' in a specified catalog and schema with input parameters and a defined return type.
  2. Defining a function with a routine body in SQL language to be used in data transformations.

Properties

Name Meaning
Catalog The catalog to use for the function creation, selectable from a list or by name.
Schema The schema within the catalog to use for the function creation, selectable from a list or by name.
Function Name Name of the function to create.
Input Parameters Array of input parameters for the function, specified in JSON format.
Return Type The return type of the function, e.g., STRING, INT, DOUBLE.
Routine Body The language of the function body, typically SQL.

Output

JSON

  • name - Name of the created function.
  • catalog_name - Catalog where the function is created.
  • schema_name - Schema where the function is created.
  • input_params - Input parameters of the function.
  • data_type - Return type of the function.
  • routine_body - The body of the function in the specified language.

Dependencies

  • Databricks API with appropriate authentication token

Troubleshooting

  • Ensure the catalog and schema names are correct and exist in the Unity Catalog.
  • Input parameters must be valid JSON and conform to expected structure.
  • Return type and routine body must be valid and supported by Databricks Unity Catalog.
  • API authentication token must have permissions to create functions in the specified catalog and schema.
  • Common errors include invalid path formats or missing required parameters, which should be checked before execution.

Links

Discussion