Skip to main content

procedures

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

Overview

Nameprocedures
TypeResource
Idsnowflake.procedure.procedures

Fields

NameDatatypeDescription
namestringName of the procedure
argumentsarrayList of arguments for the function/procedure
bodystringFunction/procedure definition
commentstringSpecifies a comment for the function/procedure
created_onstringThe date and time when the function/procedure was created
database_namestringThe name of the database in which the function/procedure exists.
execute_asstringWhat permissions should the procedure execution be called with
is_builtinbooleanIf the function/procedure is built-in or not (user-defined)
is_securebooleanSpecifies whether the function/procedure is secure or not
language_configobject
max_num_argumentsintegerThe maximum number of arguments
min_num_argumentsintegerThe minimum number of arguments
ownerstringRole that owns the function/procedure
owner_role_typestringThe type of role that owns the function/procedure
return_typeobject
schema_namestringThe name of the schema in which the function/procedure exists.

Methods

NameAccessible byRequired ParamsDescription
fetch_procedureSELECTdatabase_name, nameWithArgs, schema_name, endpointFetch a procedure
list_proceduresSELECTdatabase_name, schema_name, endpointList procedures
create_procedureINSERTdatabase_name, schema_name, data__arguments, data__body, data__language_config, data__name, data__return_type, endpointCreate a procedure
delete_procedureDELETEdatabase_name, nameWithArgs, schema_name, endpointDelete a procedure
call_procedureEXECdatabase_name, nameWithArgs, schema_name, data__call_arguments, endpointCall a procedure

SELECT examples

List procedures

SELECT
name,
arguments,
body,
comment,
created_on,
database_name,
execute_as,
is_builtin,
is_secure,
language_config,
max_num_arguments,
min_num_arguments,
owner,
owner_role_type,
return_type,
schema_name
FROM snowflake.procedure.procedures
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 procedures resource.

/*+ create */
INSERT INTO snowflake.procedure.procedures (
data__name,
data__execute_as,
data__is_secure,
data__arguments,
data__return_type,
data__language_config,
data__comment,
data__body,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ execute_as }}',
'{{ is_secure }}',
'{{ arguments }}',
'{{ return_type }}',
'{{ language_config }}',
'{{ comment }}',
'{{ body }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;

DELETE example

Deletes the specified procedures resource.

/*+ delete */
DELETE FROM snowflake.procedure.procedures
WHERE database_name = '{{ database_name }}'
AND nameWithArgs = '{{ nameWithArgs }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';