snowflake.Function
Explore with Pulumi AI
Import
format is database name | schema name | function name | <list of arg types, separated with ‘-'>
$ pulumi import snowflake:index/function:Function example 'dbName|schemaName|functionName|varchar-varchar-varchar'
Example Usage
Coming soon!
Coming soon!
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.snowflake.Database;
import com.pulumi.snowflake.DatabaseArgs;
import com.pulumi.snowflake.Schema;
import com.pulumi.snowflake.SchemaArgs;
import com.pulumi.snowflake.Function;
import com.pulumi.snowflake.FunctionArgs;
import com.pulumi.snowflake.inputs.FunctionArgumentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var db = new Database("db", DatabaseArgs.builder()
.dataRetentionDays(1)
.build());
var schema = new Schema("schema", SchemaArgs.builder()
.database(db.name())
.dataRetentionDays(1)
.build());
var testFunctJava = new Function("testFunctJava", FunctionArgs.builder()
.database("MY_DB")
.schema("MY_SCHEMA")
.arguments(FunctionArgumentArgs.builder()
.name("arg1")
.type("number")
.build())
.comment("Example for java language")
.returnType("varchar")
.language("java")
.handler("CoolFunc.test")
.statement("class CoolFunc {public static String test(int n) {return \"hello!\";}}")
.build());
var pythonTest = new Function("pythonTest", FunctionArgs.builder()
.database("MY_DB")
.schema("MY_SCHEMA")
.arguments(FunctionArgumentArgs.builder()
.name("arg1")
.type("number")
.build())
.comment("Example for Python language")
.returnType("NUMBER(38,0)")
.nullInputBehavior("CALLED ON NULL INPUT")
.returnBehavior("VOLATILE")
.language("python")
.runtimeVersion("3.8")
.handler("add_py")
.statement("def add_py(i): return i+1")
.build());
var sqlTest = new Function("sqlTest", FunctionArgs.builder()
.database("MY_DB")
.schema("MY_SCHEMA")
.arguments(FunctionArgumentArgs.builder()
.name("arg1")
.type("number")
.build())
.comment("Example for SQL language")
.returnType("NUMBER(38,0)")
.nullInputBehavior("CALLED ON NULL INPUT")
.returnBehavior("VOLATILE")
.statement("select arg1 + 1")
.build());
}
}
Coming soon!
Coming soon!
resources:
# Create database
db:
type: snowflake:Database
properties:
dataRetentionDays: 1
# Create schema
schema:
type: snowflake:Schema
properties:
database: ${db.name}
dataRetentionDays: 1
# Example for Java language
testFunctJava:
type: snowflake:Function
properties:
database: MY_DB
schema: MY_SCHEMA
arguments:
- name: arg1
type: number
comment: Example for java language
returnType: varchar
language: java
handler: CoolFunc.test
statement: class CoolFunc {public static String test(int n) {return "hello!";}}
# Example for Python language
pythonTest:
type: snowflake:Function
properties:
database: MY_DB
schema: MY_SCHEMA
arguments:
- name: arg1
type: number
comment: Example for Python language
returnType: NUMBER(38,0)
nullInputBehavior: CALLED ON NULL INPUT
returnBehavior: VOLATILE
language: python
runtimeVersion: '3.8'
handler: add_py
statement: 'def add_py(i): return i+1'
# Example SQL language
sqlTest:
type: snowflake:Function
properties:
database: MY_DB
schema: MY_SCHEMA
arguments:
- name: arg1
type: number
comment: Example for SQL language
returnType: NUMBER(38,0)
nullInputBehavior: CALLED ON NULL INPUT
returnBehavior: VOLATILE
statement: select arg1 + 1
Create Function Resource
new Function(name: string, args: FunctionArgs, opts?: CustomResourceOptions);
@overload
def Function(resource_name: str,
opts: Optional[ResourceOptions] = None,
arguments: Optional[Sequence[FunctionArgumentArgs]] = None,
comment: Optional[str] = None,
database: Optional[str] = None,
handler: Optional[str] = None,
imports: Optional[Sequence[str]] = None,
is_secure: Optional[bool] = None,
language: Optional[str] = None,
name: Optional[str] = None,
null_input_behavior: Optional[str] = None,
packages: Optional[Sequence[str]] = None,
return_behavior: Optional[str] = None,
return_type: Optional[str] = None,
runtime_version: Optional[str] = None,
schema: Optional[str] = None,
statement: Optional[str] = None,
target_path: Optional[str] = None)
@overload
def Function(resource_name: str,
args: FunctionArgs,
opts: Optional[ResourceOptions] = None)
func NewFunction(ctx *Context, name string, args FunctionArgs, opts ...ResourceOption) (*Function, error)
public Function(string name, FunctionArgs args, CustomResourceOptions? opts = null)
public Function(String name, FunctionArgs args)
public Function(String name, FunctionArgs args, CustomResourceOptions options)
type: snowflake:Function
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Function Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Function resource accepts the following input properties:
- Database string
The database in which to create the function. Don't use the | character.
- Return
Type string The return type of the function
- Schema string
The schema in which to create the function. Don't use the | character.
- Statement string
Specifies the javascript / java / sql / python code used to create the function.
- Arguments
List<Function
Argument> List of the arguments for the function
- Comment string
Specifies a comment for the function.
- Handler string
The handler method for Java / Python function.
- Imports List<string>
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- Is
Secure bool Specifies that the function is secure.
- Language string
The language of the statement
- Name string
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- Null
Input stringBehavior Specifies the behavior of the function when called with null inputs.
- Packages List<string>
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- Return
Behavior string Specifies the behavior of the function when returning results
- Runtime
Version string Required for Python functions. Specifies Python runtime version.
- Target
Path string The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
- Database string
The database in which to create the function. Don't use the | character.
- Return
Type string The return type of the function
- Schema string
The schema in which to create the function. Don't use the | character.
- Statement string
Specifies the javascript / java / sql / python code used to create the function.
- Arguments
[]Function
Argument Args List of the arguments for the function
- Comment string
Specifies a comment for the function.
- Handler string
The handler method for Java / Python function.
- Imports []string
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- Is
Secure bool Specifies that the function is secure.
- Language string
The language of the statement
- Name string
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- Null
Input stringBehavior Specifies the behavior of the function when called with null inputs.
- Packages []string
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- Return
Behavior string Specifies the behavior of the function when returning results
- Runtime
Version string Required for Python functions. Specifies Python runtime version.
- Target
Path string The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
- database String
The database in which to create the function. Don't use the | character.
- return
Type String The return type of the function
- schema String
The schema in which to create the function. Don't use the | character.
- statement String
Specifies the javascript / java / sql / python code used to create the function.
- arguments
List<Function
Argument> List of the arguments for the function
- comment String
Specifies a comment for the function.
- handler String
The handler method for Java / Python function.
- imports List<String>
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- is
Secure Boolean Specifies that the function is secure.
- language String
The language of the statement
- name String
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- null
Input StringBehavior Specifies the behavior of the function when called with null inputs.
- packages List<String>
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- return
Behavior String Specifies the behavior of the function when returning results
- runtime
Version String Required for Python functions. Specifies Python runtime version.
- target
Path String The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
- database string
The database in which to create the function. Don't use the | character.
- return
Type string The return type of the function
- schema string
The schema in which to create the function. Don't use the | character.
- statement string
Specifies the javascript / java / sql / python code used to create the function.
- arguments
Function
Argument[] List of the arguments for the function
- comment string
Specifies a comment for the function.
- handler string
The handler method for Java / Python function.
- imports string[]
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- is
Secure boolean Specifies that the function is secure.
- language string
The language of the statement
- name string
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- null
Input stringBehavior Specifies the behavior of the function when called with null inputs.
- packages string[]
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- return
Behavior string Specifies the behavior of the function when returning results
- runtime
Version string Required for Python functions. Specifies Python runtime version.
- target
Path string The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
- database str
The database in which to create the function. Don't use the | character.
- return_
type str The return type of the function
- schema str
The schema in which to create the function. Don't use the | character.
- statement str
Specifies the javascript / java / sql / python code used to create the function.
- arguments
Sequence[Function
Argument Args] List of the arguments for the function
- comment str
Specifies a comment for the function.
- handler str
The handler method for Java / Python function.
- imports Sequence[str]
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- is_
secure bool Specifies that the function is secure.
- language str
The language of the statement
- name str
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- null_
input_ strbehavior Specifies the behavior of the function when called with null inputs.
- packages Sequence[str]
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- return_
behavior str Specifies the behavior of the function when returning results
- runtime_
version str Required for Python functions. Specifies Python runtime version.
- target_
path str The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
- database String
The database in which to create the function. Don't use the | character.
- return
Type String The return type of the function
- schema String
The schema in which to create the function. Don't use the | character.
- statement String
Specifies the javascript / java / sql / python code used to create the function.
- arguments List<Property Map>
List of the arguments for the function
- comment String
Specifies a comment for the function.
- handler String
The handler method for Java / Python function.
- imports List<String>
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- is
Secure Boolean Specifies that the function is secure.
- language String
The language of the statement
- name String
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- null
Input StringBehavior Specifies the behavior of the function when called with null inputs.
- packages List<String>
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- return
Behavior String Specifies the behavior of the function when returning results
- runtime
Version String Required for Python functions. Specifies Python runtime version.
- target
Path String The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
Outputs
All input properties are implicitly available as output properties. Additionally, the Function resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing Function Resource
Get an existing Function resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: FunctionState, opts?: CustomResourceOptions): Function
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
arguments: Optional[Sequence[FunctionArgumentArgs]] = None,
comment: Optional[str] = None,
database: Optional[str] = None,
handler: Optional[str] = None,
imports: Optional[Sequence[str]] = None,
is_secure: Optional[bool] = None,
language: Optional[str] = None,
name: Optional[str] = None,
null_input_behavior: Optional[str] = None,
packages: Optional[Sequence[str]] = None,
return_behavior: Optional[str] = None,
return_type: Optional[str] = None,
runtime_version: Optional[str] = None,
schema: Optional[str] = None,
statement: Optional[str] = None,
target_path: Optional[str] = None) -> Function
func GetFunction(ctx *Context, name string, id IDInput, state *FunctionState, opts ...ResourceOption) (*Function, error)
public static Function Get(string name, Input<string> id, FunctionState? state, CustomResourceOptions? opts = null)
public static Function get(String name, Output<String> id, FunctionState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Arguments
List<Function
Argument> List of the arguments for the function
- Comment string
Specifies a comment for the function.
- Database string
The database in which to create the function. Don't use the | character.
- Handler string
The handler method for Java / Python function.
- Imports List<string>
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- Is
Secure bool Specifies that the function is secure.
- Language string
The language of the statement
- Name string
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- Null
Input stringBehavior Specifies the behavior of the function when called with null inputs.
- Packages List<string>
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- Return
Behavior string Specifies the behavior of the function when returning results
- Return
Type string The return type of the function
- Runtime
Version string Required for Python functions. Specifies Python runtime version.
- Schema string
The schema in which to create the function. Don't use the | character.
- Statement string
Specifies the javascript / java / sql / python code used to create the function.
- Target
Path string The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
- Arguments
[]Function
Argument Args List of the arguments for the function
- Comment string
Specifies a comment for the function.
- Database string
The database in which to create the function. Don't use the | character.
- Handler string
The handler method for Java / Python function.
- Imports []string
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- Is
Secure bool Specifies that the function is secure.
- Language string
The language of the statement
- Name string
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- Null
Input stringBehavior Specifies the behavior of the function when called with null inputs.
- Packages []string
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- Return
Behavior string Specifies the behavior of the function when returning results
- Return
Type string The return type of the function
- Runtime
Version string Required for Python functions. Specifies Python runtime version.
- Schema string
The schema in which to create the function. Don't use the | character.
- Statement string
Specifies the javascript / java / sql / python code used to create the function.
- Target
Path string The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
- arguments
List<Function
Argument> List of the arguments for the function
- comment String
Specifies a comment for the function.
- database String
The database in which to create the function. Don't use the | character.
- handler String
The handler method for Java / Python function.
- imports List<String>
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- is
Secure Boolean Specifies that the function is secure.
- language String
The language of the statement
- name String
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- null
Input StringBehavior Specifies the behavior of the function when called with null inputs.
- packages List<String>
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- return
Behavior String Specifies the behavior of the function when returning results
- return
Type String The return type of the function
- runtime
Version String Required for Python functions. Specifies Python runtime version.
- schema String
The schema in which to create the function. Don't use the | character.
- statement String
Specifies the javascript / java / sql / python code used to create the function.
- target
Path String The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
- arguments
Function
Argument[] List of the arguments for the function
- comment string
Specifies a comment for the function.
- database string
The database in which to create the function. Don't use the | character.
- handler string
The handler method for Java / Python function.
- imports string[]
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- is
Secure boolean Specifies that the function is secure.
- language string
The language of the statement
- name string
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- null
Input stringBehavior Specifies the behavior of the function when called with null inputs.
- packages string[]
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- return
Behavior string Specifies the behavior of the function when returning results
- return
Type string The return type of the function
- runtime
Version string Required for Python functions. Specifies Python runtime version.
- schema string
The schema in which to create the function. Don't use the | character.
- statement string
Specifies the javascript / java / sql / python code used to create the function.
- target
Path string The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
- arguments
Sequence[Function
Argument Args] List of the arguments for the function
- comment str
Specifies a comment for the function.
- database str
The database in which to create the function. Don't use the | character.
- handler str
The handler method for Java / Python function.
- imports Sequence[str]
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- is_
secure bool Specifies that the function is secure.
- language str
The language of the statement
- name str
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- null_
input_ strbehavior Specifies the behavior of the function when called with null inputs.
- packages Sequence[str]
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- return_
behavior str Specifies the behavior of the function when returning results
- return_
type str The return type of the function
- runtime_
version str Required for Python functions. Specifies Python runtime version.
- schema str
The schema in which to create the function. Don't use the | character.
- statement str
Specifies the javascript / java / sql / python code used to create the function.
- target_
path str The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
- arguments List<Property Map>
List of the arguments for the function
- comment String
Specifies a comment for the function.
- database String
The database in which to create the function. Don't use the | character.
- handler String
The handler method for Java / Python function.
- imports List<String>
Imports for Java / Python functions. For Java this a list of jar files, for Python this is a list of Python files.
- is
Secure Boolean Specifies that the function is secure.
- language String
The language of the statement
- name String
Specifies the identifier for the function; does not have to be unique for the schema in which the function is created. Don't use the | character.
- null
Input StringBehavior Specifies the behavior of the function when called with null inputs.
- packages List<String>
List of package imports to use for Java / Python functions. For Java, package imports should be of the form: packagename:versionnumber, where packagename is snowflakedomain:package. For Python use it should be: ('numpy','pandas','xgboost==1.5.0').
- return
Behavior String Specifies the behavior of the function when returning results
- return
Type String The return type of the function
- runtime
Version String Required for Python functions. Specifies Python runtime version.
- schema String
The schema in which to create the function. Don't use the | character.
- statement String
Specifies the javascript / java / sql / python code used to create the function.
- target
Path String The target path for the Java / Python functions. For Java, it is the path of compiled jar files and for the Python it is the path of the Python files.
Supporting Types
FunctionArgument, FunctionArgumentArgs
Package Details
- Repository
- Snowflake pulumi/pulumi-snowflake
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
snowflake
Terraform Provider.