functions
Operations on a functions
resource.
Overview
Name | functions |
Type | Resource |
Id | databricks_workspace.unitycatalog.functions |
Fields
Name | Datatype |
---|---|
name | string |
browse_only | boolean |
catalog_name | string |
comment | string |
created_at | integer |
created_by | string |
data_type | string |
external_language | string |
external_name | string |
full_data_type | string |
full_name | string |
function_id | string |
input_params | object |
is_deterministic | boolean |
is_null_call | boolean |
metastore_id | string |
owner | string |
parameter_style | string |
properties | string |
return_params | object |
routine_body | string |
routine_definition | string |
routine_dependencies | object |
schema_name | string |
security_type | string |
specific_name | string |
sql_data_access | string |
sql_path | string |
updated_at | integer |
updated_by | string |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | name, deployment_name | Gets a function from within a parent catalog and schema. For the fetch to succeed, the user must satisfy one of the following requirements: |
list | SELECT | catalog_name, schema_name, deployment_name | 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 |
create | INSERT | deployment_name | |
delete | DELETE | name, deployment_name | Deletes the function that matches the supplied name. For the deletion to succeed, the user must satisfy one of the following conditions: |
update | UPDATE | name, deployment_name | Updates 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
- functions (get)
- functions (list)
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 }}';
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 catalog_name = '{{ catalog_name }}' AND
schema_name = '{{ schema_name }}' AND
deployment_name = '{{ deployment_name }}';
INSERT
example
Use the following StackQL query and manifest file to create a new functions
resource.
- functions
- Manifest
/*+ create */
INSERT INTO databricks_workspace.unitycatalog.functions (
deployment_name,
data__function_info
)
SELECT
'{{ deployment_name }}',
'{{ function_info }}'
;
- name: your_resource_model_name
props:
- name: function_info
value:
name: string
catalog_name: string
schema_name: string
input_params:
parameters:
- name: string
type_text: string
type_json: string
type_name: BOOLEAN
type_precision: 0
type_scale: 0
type_interval_type: string
position: 0
parameter_mode: IN
parameter_type: PARAM
parameter_default: string
comment: string
data_type: BOOLEAN
full_data_type: string
return_params:
parameters:
- name: string
type_text: string
type_json: string
type_name: BOOLEAN
type_precision: 0
type_scale: 0
type_interval_type: string
position: 0
parameter_mode: IN
parameter_type: PARAM
parameter_default: string
comment: string
routine_definition: string
routine_dependencies:
dependencies:
- table:
table_full_name: string
function:
function_full_name: string
is_deterministic: true
is_null_call: true
specific_name: string
external_name: string
external_language: string
sql_path: string
comment: string
properties: string
routine_body: SQL
security_type: DEFINER
sql_data_access: CONTAINS_SQL
parameter_style: S
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 }}';