snowflake.core.function.FunctionCollection

class snowflake.core.function.FunctionCollection(schema: SchemaResource)

Bases: SchemaObjectCollectionParent[FunctionResource]

Represents the collection operations on the Snowflake Function resource.

With this collection, you can create role or iterate or fetch function that you have access to.

Parameters:

schema – A :class:schema instance.

Example

Create a FunctionCollection instance: >>> functions = schema.functions >>> functions.create(new_function)

Attributes

database
root
schema

Methods

__init__(schema: SchemaResource)
create(function: Function, mode: CreateMode = CreateMode.error_if_exists) FunctionResource

Create a Functionm, currently only support service function.

Parameters:
  • function – The service function object, together with function properties: name, returns, arguments, service, endpoint, path optional: max_batch_rows

  • mode

    One of the following strings.

    CreateMode.error_if_exists: Throw an snowflake.core.exceptions.ConflictError if the function already exists in Snowflake. Equivalent to SQL create function <name> ....

    CreateMode.or_replace: Replace if the task already exists in Snowflake. Equivalent to SQL create or replace function <name> ....

    CreateMode.if_not_exists: Do nothing if the task already exists in Snowflake. Equivalent to SQL create function <name> if not exists...

    Default value is CreateMode.error_if_exists.

items() ItemsView[str, T]
iter(*, like: str | None = None) Iterator[Function]

Search Function objects from Snowflake.

Parameters:

like – The pattern of the function’s name. Use % to represent any number of characters and ? for a single character.

keys() KeysView[str]
values() ValuesView[T]