Skip to main content

functions

Creates, updates, deletes, gets or lists a functions resource.

Overview

Namefunctions
TypeResource
Iddatabricks_workspace.catalog.functions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringName of function, relative to parent schema.
function_idstringId of Function, relative to parent schema.
metastore_idstringUnique identifier of parent metastore.
catalog_namestringName of parent Catalog.
external_namestringExternal function name.
full_namestringFull name of Function, in form of **catalog_name**.**schema_name**.**function_name**
schema_namestringName of parent Schema relative to its parent Catalog.
specific_namestringSpecific name of the function; Reserved for future use.
browse_onlyboolean
commentstringUser-provided free-form text description.
created_atintegerTime at which this function was created, in epoch milliseconds.
created_bystringUsername of function creator.
data_typestringScalar function return data type. (ARRAY, BINARY, BOOLEAN, BYTE, CHAR, DATE, DECIMAL, DOUBLE, FLOAT, GEOGRAPHY, GEOMETRY, INT, INTERVAL, LONG, MAP, NULL, SHORT, STRING, STRUCT, TABLE_TYPE, TIMESTAMP, TIMESTAMP_NTZ, USER_DEFINED_TYPE, VARIANT)
external_languagestringExternal function language.
full_data_typestringPretty printed function data type.
input_paramsobjectFunction input parameters.
is_deterministicbooleanWhether the function is deterministic.
is_null_callbooleanFunction null call.
ownerstringUsername of current owner of the function.
parameter_stylestringFunction parameter style. **S** is the value for SQL. (S)
propertiesstringJSON-serialized key-value pair map, encoded (escaped) as a string.
return_paramsobjectTable function return parameters.
routine_bodystringFunction language. 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**. (EXTERNAL, SQL)
routine_definitionstringFunction body.
routine_dependenciesobjectfunction dependencies.
security_typestringFunction security type. (DEFINER)
sql_data_accessstringFunction SQL data access. (CONTAINS_SQL, NO_SQL, READS_SQL_DATA)
sql_pathstringList of schemes whose objects can be referenced without qualification.
updated_atintegerTime at which this function was last modified, in epoch milliseconds.
updated_bystringUsername of user who last modified the function.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectname, deployment_nameinclude_browseGets a function from within a parent catalog and schema. For the fetch to succeed, the user must
listselectcatalog_name, schema_name, deployment_nameinclude_browse, max_results, page_tokenList functions within the specified parent catalog and schema. If the user is a metastore admin, all
createinsertdeployment_name, function_infoWARNING: This API is experimental and will change in future versions
updateupdatename, deployment_nameUpdates the function that matches the supplied name. Only the owner of the function can be updated. If
deletedeletename, deployment_nameforceDeletes the function that matches the supplied name. For the deletion to succeed, the user must

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
catalog_namestringName of parent catalog for functions of interest.
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
namestringThe fully-qualified name of the function (of the form catalog_name.schema_name.function__name) .
schema_namestringParent schema of functions.
forcebooleanForce deletion even if the function is notempty.
include_browsebooleanWhether to include functions in the response for which the principal can only access selective metadata for
max_resultsintegerMaximum number of functions to return. If not set, all the functions are returned (not recommended). - when set to a value greater than 0, the page length is the minimum of this value and a server configured value; - when set to 0, the page length is set to a server configured value (recommended); - when set to a value less than 0, an invalid parameter error is returned;
page_tokenstringOpaque pagination token to go to next page based on previous query.

SELECT examples

Gets a function from within a parent catalog and schema. For the fetch to succeed, the user must

SELECT
name,
function_id,
metastore_id,
catalog_name,
external_name,
full_name,
schema_name,
specific_name,
browse_only,
comment,
created_at,
created_by,
data_type,
external_language,
full_data_type,
input_params,
is_deterministic,
is_null_call,
owner,
parameter_style,
properties,
return_params,
routine_body,
routine_definition,
routine_dependencies,
security_type,
sql_data_access,
sql_path,
updated_at,
updated_by
FROM databricks_workspace.catalog.functions
WHERE name = '{{ name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND include_browse = '{{ include_browse }}'
;

INSERT examples

WARNING: This API is experimental and will change in future versions

INSERT INTO databricks_workspace.catalog.functions (
function_info,
deployment_name
)
SELECT
'{{ function_info }}' /* required */,
'{{ deployment_name }}'
RETURNING
name,
function_id,
metastore_id,
catalog_name,
external_name,
full_name,
schema_name,
specific_name,
browse_only,
comment,
created_at,
created_by,
data_type,
external_language,
full_data_type,
input_params,
is_deterministic,
is_null_call,
owner,
parameter_style,
properties,
return_params,
routine_body,
routine_definition,
routine_dependencies,
security_type,
sql_data_access,
sql_path,
updated_at,
updated_by
;

UPDATE examples

Updates the function that matches the supplied name. Only the owner of the function can be updated. If

UPDATE databricks_workspace.catalog.functions
SET
owner = '{{ owner }}'
WHERE
name = '{{ name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
RETURNING
name,
function_id,
metastore_id,
catalog_name,
external_name,
full_name,
schema_name,
specific_name,
browse_only,
comment,
created_at,
created_by,
data_type,
external_language,
full_data_type,
input_params,
is_deterministic,
is_null_call,
owner,
parameter_style,
properties,
return_params,
routine_body,
routine_definition,
routine_dependencies,
security_type,
sql_data_access,
sql_path,
updated_at,
updated_by;

DELETE examples

Deletes the function that matches the supplied name. For the deletion to succeed, the user must

DELETE FROM databricks_workspace.catalog.functions
WHERE name = '{{ name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND force = '{{ force }}'
;