---
title: functions command group
description: Learn how to use the Databricks CLI functions commands
canonical_url: https://docs.databricks.com/aws/en/dev-tools/cli/reference/functions-commands
---

# `functions` command group

> [!NOTE]
>
> Databricks CLI use is subject to the [Databricks License](https://github.com/databricks/cli?tab=License-1-ov-file#readme) and [Databricks Privacy Notice](https://www.databricks.com/legal/privacynotice), including any Usage Data provisions.

The `functions` command group within the [Databricks CLI](https://docs.databricks.com/aws/en/dev-tools/cli/index.md) allows you to manage [user-defined functions (UDFs)](https://docs.databricks.com/aws/en/udf/unity-catalog.md) in Unity Catalog. The function implementation can be any SQL expression or query, and it can be invoked wherever a table reference is allowed in a query. In Unity Catalog, a function resides at the same level as a table, so it can be referenced with the form `catalog_name.schema_name.function_name`.

## databricks functions create

Create a new function.

> [!NOTE]
> **Experimental**
>
> This is an experimental feature.

The user must have the following permissions in order for the function to be created:

-`USE_CATALOG` on the function's parent catalog

* `USE_SCHEMA` and `CREATE_FUNCTION` on the function's parent schema

```
databricks functions create [flags]
```

#### Options

**`--json JSON`**

    The inline JSON string or the @path to the JSON file with the request body.

[Global flags](https://docs.databricks.com/aws/en/dev-tools/cli/reference/functions-commands.md#global-flags)

#### Examples

The following example creates a function using a JSON file:

```bash
databricks functions create --json @function-definition.json
```

The following example creates a function using inline JSON:

```bash
databricks functions create --json '{"name": "my_catalog.my_schema.my_function", "data_type": "INT", "full_data_type": "INT", "return_params": {"parameters": []}, "routine_body": "SQL", "routine_definition": "SELECT 1", "routine_dependencies": {"dependencies": []}, "parameter_style": "S", "is_deterministic": true, "sql_data_access": "CONTAINS_SQL", "is_null_call": false, "security_type": "DEFINER", "specific_name": "my_function"}'
```

## databricks functions delete

Delete the function that matches the supplied name.

For the deletion to succeed, the user must satisfy one of the following conditions:

* Is the owner of the function's parent catalog
* Is the owner of the function's parent schema and have the `USE_CATALOG` privilege on its parent catalog
* Is the owner of the function itself and have both the `USE_CATALOG` privilege on its parent catalog and the `USE_SCHEMA` privilege on its parent schema

```
databricks functions delete NAME [flags]
```

#### Arguments

**`NAME`**

    The fully-qualified name of the function (of the form `catalog_name.schema_name.function_name`).

#### Options

**`--force`**

    Force deletion even if the function is notempty.

[Global flags](https://docs.databricks.com/aws/en/dev-tools/cli/reference/functions-commands.md#global-flags)

#### Examples

The following example deletes a function:

```bash
databricks functions delete my_catalog.my_schema.my_function
```

The following example forces deletion of a function:

```bash
databricks functions delete my_catalog.my_schema.my_function --force
```

## databricks functions get

Get a function from within a parent catalog and schema.

For the fetch to succeed, the user must satisfy one of the following requirements:

* Is a metastore admin
* Is an owner of the function's parent catalog
* Have the `USE_CATALOG` privilege on the function's parent catalog and be the owner of the function
* Have the `USE_CATALOG` privilege on the function's parent catalog, the `USE_SCHEMA` privilege on the function's parent schema, and the `EXECUTE` privilege on the function itself

```
databricks functions get NAME [flags]
```

#### Arguments

**`NAME`**

    The fully-qualified name of the function (of the form `catalog_name.schema_name.function_name`).

#### Options

**`--include-browse`**

    Whether to include functions in the response for which the principal can only access selective metadata for.

[Global flags](https://docs.databricks.com/aws/en/dev-tools/cli/reference/functions-commands.md#global-flags)

#### Examples

The following example gets information about a function:

```bash
databricks functions get my_catalog.my_schema.my_function
```

The following example gets a function with browse information included:

```bash
databricks functions get my_catalog.my_schema.my_function --include-browse
```

## databricks functions list

List functions within the specified parent catalog and schema.

If the user is a metastore admin, all functions are returned in the output list. Otherwise, the user must have the `USE_CATALOG` privilege on the catalog and the `USE_SCHEMA` privilege on the schema, and the output list contains only functions for which either the user has the `EXECUTE` privilege or the user is the owner. There is no guarantee of a specific ordering of the elements in the array.

```
databricks functions list CATALOG_NAME SCHEMA_NAME [flags]
```

#### Arguments

**`CATALOG_NAME`**

    Name of parent catalog for functions of interest.

**`SCHEMA_NAME`**

    Parent schema of functions.

#### Options

**`--include-browse`**

    Whether to include functions in the response for which the principal can only access selective metadata for.

**`--limit int`**

    Maximum number of functions to return.

[Global flags](https://docs.databricks.com/aws/en/dev-tools/cli/reference/functions-commands.md#global-flags)

#### Examples

The following example lists all functions in a catalog and schema:

```bash
databricks functions list my_catalog my_schema
```

The following example lists functions with a maximum of 10 results:

```bash
databricks functions list my_catalog my_schema --limit 10
```

The following example lists functions with browse information included:

```bash
databricks functions list my_catalog my_schema --include-browse
```

## databricks functions update

Update the function that matches the supplied name.

Only the owner of the function can be updated. If the user is not a metastore admin, the user must be a member of the group that is the new function owner. The user must satisfy one of the following conditions:

* Is a metastore admin
* Is the owner of the function's parent catalog
* Is the owner of the function's parent schema and has the `USE_CATALOG` privilege on its parent catalog
* Is the owner of the function itself and has the `USE_CATALOG` privilege on its parent catalog as well as the `USE_SCHEMA` privilege on the function's parent schema

```
databricks functions update NAME [flags]
```

#### Arguments

**`NAME`**

    The fully-qualified name of the function (of the form `catalog_name.schema_name.function_name`).

#### Options

**`--json JSON`**

    The inline JSON string or the @path to the JSON file with the request body.

**`--owner string`**

    Username of current owner of function.

[Global flags](https://docs.databricks.com/aws/en/dev-tools/cli/reference/functions-commands.md#global-flags)

#### Examples

The following example updates a function's owner:

```bash
databricks functions update my_catalog.my_schema.my_function --owner someone@example.com
```

## <a id="global-flags" />Global flags

**`--debug`**

  Whether to enable debug logging.

**`-h` or `--help`**

    Display help for the Databricks CLI or the related command group or the related command.

**`--log-file` string**

    A string representing the file to write output logs to. If this flag is not specified then the default is to write output logs to stderr.

**`--log-format` format**

    The log format type, `text` or `json`. The default value is `text`.

**`--log-level` string**

    A string representing the log format level. If not specified then the log format level is disabled.

**`-o, --output` type**

    The command output type, `text` or `json`. The default value is `text`.

**`-p, --profile` string**

    The name of the profile in the `~/.databrickscfg` file to use to run the command. If this flag is not specified then if it exists, the profile named `DEFAULT` is used.

**`--progress-format` format**

    The format to display progress logs: `default`, `append`, `inplace`, or `json`

**`-t, --target` string**

    If applicable, the bundle target to use
