Skip to main content

functions

Operations on a functions resource.

Overview

Namefunctions
TypeResource
Iddatabricks_workspace.unitycatalog.functions

Fields

NameDatatype
namestring
browse_onlyboolean
catalog_namestring
commentstring
created_atinteger
created_bystring
data_typestring
external_languagestring
external_namestring
full_data_typestring
full_namestring
function_idstring
input_paramsobject
is_deterministicboolean
is_null_callboolean
metastore_idstring
ownerstring
parameter_stylestring
propertiesstring
return_paramsobject
routine_bodystring
routine_definitionstring
routine_dependenciesobject
schema_namestring
security_typestring
specific_namestring
sql_data_accessstring
sql_pathstring
updated_atinteger
updated_bystring

Methods

NameAccessible byRequired ParamsDescription
getSELECTname, deployment_nameGets a function from within a parent catalog and schema. For the fetch to succeed, the user must satisfy one of the following requirements:
listSELECTcatalog_name, schema_name, deployment_nameList 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
createINSERTdeployment_name
deleteDELETEname, deployment_nameDeletes the function that matches the supplied name. For the deletion to succeed, the user must satisfy one of the following conditions:
updateUPDATEname, deployment_nameUpdates 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.

SELECT examples

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

INSERT example

Use the following StackQL query and manifest file to create a new functions resource.

/*+ create */
INSERT INTO databricks_workspace.unitycatalog.functions (
deployment_name,
data__function_info
)
SELECT
'{{ deployment_name }}',
'{{ function_info }}'
;

UPDATE example

Updates a functions resource.

/*+ update */
-- replace field1, field2, etc. with the fields you want to update
UPDATE databricks_workspace.unitycatalog.functions
SET field1 = '{{ value1 }}',
field2 = '{{ value2 }}', ...
WHERE name = '{{ name }}' AND
deployment_name = '{{ deployment_name }}';

DELETE example

Deletes a functions resource.

/*+ delete */
DELETE FROM databricks_workspace.unitycatalog.functions
WHERE name = '{{ name }}' AND
deployment_name = '{{ deployment_name }}';