|
| 1 | +--- |
| 2 | +subcategory: "Unity Catalog" |
| 3 | +--- |
| 4 | +# databricks_functionss Data Source |
| 5 | + |
| 6 | +-> This data source can only be used with a workspace-level provider! |
| 7 | + |
| 8 | +Retrieves a list of [User-Defined Functions (UDFs) registered in the Unity Catalog](https://docs.databricks.com/en/udf/unity-catalog.html). |
| 9 | + |
| 10 | +## Example Usage |
| 11 | + |
| 12 | +List all functions defined in a specific schema (`main.default` in this example): |
| 13 | + |
| 14 | +```hcl |
| 15 | +data "databricks_functions" "all" { |
| 16 | + catalog_name = "main" |
| 17 | + schema_name = "default" |
| 18 | +} |
| 19 | +
|
| 20 | +output "all_external_locations" { |
| 21 | + value = data.databricks_functions.all.functions |
| 22 | +} |
| 23 | +``` |
| 24 | + |
| 25 | +## Argument Reference |
| 26 | + |
| 27 | +The following arguments are supported: |
| 28 | + |
| 29 | +* `catalog_name` - (Required) Name of [databricks_catalog](../resources/catalog.md). |
| 30 | +* `schema_name` - (Required) Name of [databricks_schema](../resources/schema.md). |
| 31 | +* `include_browse` - (Optional, Boolean) flag to specify if include UDFs in the response for which the principal can only access selective metadata for. |
| 32 | + |
| 33 | +## Attribute Reference |
| 34 | + |
| 35 | +This data source exports the following attributes: |
| 36 | + |
| 37 | +* `functions` - list of objects describing individual UDF. Each object consists of the following attributes (refer to [REST API documentation](https://docs.databricks.com/api/workspace/functions/list#functions) for up-to-date list of attributes. Default type is String): |
| 38 | + * `name` - Name of function, relative to parent schema. |
| 39 | + * `catalog_name` - Name of parent catalog. |
| 40 | + * `schema_name` - Name of parent schema relative to its parent catalog. |
| 41 | + * `input_params` - object describing input parameters. Consists of the single attribute: |
| 42 | + * `parameters` - The array of definitions of the function's parameters: |
| 43 | + * `name` - Name of parameter. |
| 44 | + * `type_text` - Full data type spec, SQL/catalogString text. |
| 45 | + * `type_json` - Full data type spec, JSON-serialized. |
| 46 | + * `type_name` - Name of type (INT, STRUCT, MAP, etc.). |
| 47 | + * `type_precision` - Digits of precision; required on Create for DecimalTypes. |
| 48 | + * `type_scale` - Digits to right of decimal; Required on Create for DecimalTypes. |
| 49 | + * `type_interval_type` - Format of IntervalType. |
| 50 | + * `position` - Ordinal position of column (starting at position 0). |
| 51 | + * `parameter_mode` - The mode of the function parameter. |
| 52 | + * `parameter_type` - The type of function parameter (`PARAM` or `COLUMN`). |
| 53 | + * `parameter_default` - Default value of the parameter. |
| 54 | + * `comment` - User-provided free-form text description. |
| 55 | + * `return_params` - Table function return parameters. See `input_params` for description. |
| 56 | + * `data_type` - Scalar function return data type. |
| 57 | + * `full_data_type` - Pretty printed function data type. |
| 58 | + * `routine_body` - Function language (`SQL` or `EXTERNAL`). When `EXTERNAL` is used, the language of the routine function should be specified in the `external_language` field, and the `return_params` of the function cannot be used (as `TABLE` return type is not supported), and the `sql_data_access` field must be `NO_SQL`. |
| 59 | + * `routine_definition` - Function body. |
| 60 | + * `routine_dependencies` - Function dependencies. |
| 61 | + * `parameter_style` - Function parameter style. `S` is the value for SQL. |
| 62 | + * `is_deterministic` - Boolean flag specifying whether the function is deterministic. |
| 63 | + * `sql_data_access` - Function SQL data access (`CONTAINS_SQL`, `READS_SQL_DATA`, `NO_SQL`). |
| 64 | + * `is_null_call` - Boolean flag whether function null call. |
| 65 | + * `security_type` - Function security type. (Enum: `DEFINER`). |
| 66 | + * `specific_name` - Specific name of the function; Reserved for future use. |
| 67 | + * `external_name` - External function name. |
| 68 | + * `external_language` - External function language. |
| 69 | + * `sql_path` - List of schemes whose objects can be referenced without qualification. |
| 70 | + * `owner` - Username of current owner of function. |
| 71 | + * `comment` - User-provided free-form text description. |
| 72 | + * `properties` - JSON-serialized key-value pair map, encoded (escaped) as a string. |
| 73 | + * `metastore_id` - Unique identifier of parent metastore. |
| 74 | + * `full_name` - Full name of function, in form of catalog_name.schema_name.function__name |
| 75 | + * `created_at` - Time at which this function was created, in epoch milliseconds. |
| 76 | + * `created_by` - Username of function creator. |
| 77 | + * `updated_at` - Time at which this function was created, in epoch milliseconds. |
| 78 | + * `updated_by` - Username of user who last modified function. |
| 79 | + * `function_id` - Id of Function, relative to parent schema. |
| 80 | + * `browse_only` - Indicates whether the principal is limited to retrieving metadata for the associated object through the `BROWSE` privilege when `include_browse` is enabled in the request. |
| 81 | + |
| 82 | +## Related Resources |
| 83 | + |
| 84 | +The following resources are used in the same context: |
| 85 | + |
| 86 | +* [databricks_schema](./schema.md) to get information about a single schema |
0 commit comments