functions
Creates, updates, deletes, gets or lists a functions
resource.
Overview
Name | functions |
Type | Resource |
Id | snowflake.function.functions |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Specifies the name for the function, must be unique for the schema in which the function is created |
arguments | array | |
body | string | Function's body. |
created_on | string | Date and time when the function was created. |
function_type | string | |
language | string | Function's language. |
max_batch_rows | integer | Specifies the max rows for batch operation. |
returns | string | Specifies the type for the function return value. |
signature | string | Function's arguments. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
fetch_function | SELECT | database_name, nameWithArgs, schema_name, endpoint | Fetch a Function using the describe command output. |
list_functions | SELECT | database_name, schema_name, endpoint | Lists the user functions under the database and schema. |
create_function | INSERT | database_name, schema_name, data__arguments, data__name, endpoint | Create a function. |
delete_function | DELETE | database_name, nameWithArgs, schema_name, endpoint | Delete a function with the given name and args. |
execute_function | EXEC | database_name, name, schema_name, endpoint | Execute a Function. |
SELECT
examples
Lists the user functions under the database and schema.
SELECT
name,
arguments,
body,
created_on,
function_type,
language,
max_batch_rows,
returns,
signature
FROM snowflake.function.functions
WHERE database_name = '{{ database_name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';
INSERT
example
Use the following StackQL query and manifest file to create a new functions
resource.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO snowflake.function.functions (
data__function_type,
data__name,
data__arguments,
data__returns,
data__max_batch_rows,
data__created_on,
data__signature,
data__language,
data__body,
database_name,
schema_name,
endpoint
)
SELECT
'{{ function_type }}',
'{{ name }}',
'{{ arguments }}',
'{{ returns }}',
'{{ max_batch_rows }}',
'{{ created_on }}',
'{{ signature }}',
'{{ language }}',
'{{ body }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
/*+ create */
INSERT INTO snowflake.function.functions (
data__name,
data__arguments,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ arguments }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
- name: functions
props:
- name: database_name
value: string
- name: schema_name
value: string
- name: data__arguments
value: string
- name: data__name
value: string
- name: endpoint
value: string
- name: function_type
value: string
- name: name
value: string
- name: arguments
value: array
props:
- name: name
value: string
- name: datatype
value: string
- name: value
value: string
- name: returns
value: string
- name: max_batch_rows
value: integer
- name: created_on
value: string
- name: signature
value: string
- name: language
value: string
- name: body
value: string
DELETE
example
Deletes the specified functions
resource.
/*+ delete */
DELETE FROM snowflake.function.functions
WHERE database_name = '{{ database_name }}'
AND nameWithArgs = '{{ nameWithArgs }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';