Titan Core
  • Overview
  • Getting Started
  • Working With Resources
  • Blueprint
  • GitHub Action
  • Resources
    • APIAuthenticationSecurityIntegration
    • APIIntegration
    • AccountParameter
    • AggregationPolicy
    • Alert
    • AuthenticationPolicy
    • AzureStorageIntegration
    • ComputePool
    • Database
    • DatabaseRole
    • DynamicTable
    • EmailNotificationIntegration
    • EventTable
    • ExternalAccessIntegration
    • ExternalStage
    • FailoverGroup
    • FutureGrant
    • GCSStorageIntegration
    • GenericSecret
    • GlueCatalogIntegration
    • Grant
    • GrantOnAll
    • HybridTable
    • ImageRepository
    • InternalStage
    • JSONFileFormat
    • JavascriptUDF
    • MaterializedView
    • NetworkPolicy
    • NetworkRule
    • OAuthSecret
    • ObjectStoreCatalogIntegration
    • PackagesPolicy
    • ParquetFileFormat
    • PasswordPolicy
    • PasswordSecret
    • Pipe
    • PythonStoredProcedure
    • PythonUDF
    • ReplicationGroup
    • ResourceMonitor
    • Role
    • RoleGrant
    • S3StorageIntegration
    • Schema
    • Sequence
    • Service
    • SessionPolicy
    • Share
    • SnowflakePartnerOAuthSecurityIntegration
    • SnowservicesOAuthSecurityIntegration
    • StageStream
    • Table
    • TableStream
    • Tag
    • Task
    • User
    • View
    • ViewStream
    • Warehouse
Powered by GitBook
On this page
  • Examples
  • Python
  • YAML
  • Fields
  1. Resources

PythonStoredProcedure

PreviousPipeNextPythonUDF

Last updated 10 months ago

Represents a Python stored procedure in Snowflake, allowing for the execution of Python code within the Snowflake environment.

Examples

Python

procedure = PythonStoredProcedure(
    name="some_procedure",
    args=[],
    returns="STRING",
    runtime_version="3.8",
    packages=["snowflake-snowpark-python"],
    handler="process_data",
    as_="def process_data(): return 'Hello, World!'",
    comment="A simple procedure",
    copy_grants=False,
    execute_as="CALLER",
    external_access_integrations=None,
    imports=None,
    null_handling="CALLED_ON_NULL_INPUT",
    owner="SYSADMIN",
    secure=False
)

YAML

procedures:
- name: some_procedure
    args: []
    returns: STRING
    runtime_version: "3.8"
    packages:
    - snowflake-snowpark-python
    handler: process_data
    as_: "def process_data(): return 'Hello, World!'"
    comment: "A simple procedure"
    copy_grants: false
    execute_as: CALLER
    external_access_integrations: null
    imports: null
    null_handling: CALLED_ON_NULL_INPUT
    owner: SYSADMIN
    secure: false

Fields

  • name (str, required) - The name of the procedure.

  • args (list) - The arguments of the procedure.

  • runtime_version (str, required) - The Python runtime version.

  • packages (list) - The list of packages required by the procedure.

  • handler (str, required) - The handler function for the procedure.

  • as_ (str) - The procedure definition.

  • comment (str) - A comment about the procedure. Defaults to "user-defined procedure".

  • copy_grants (bool) - Whether to copy grants. Defaults to False.

  • external_access_integrations (list) - External access integrations if any.

  • imports (list) - Files to import.

  • secure (bool) - Whether the procedure is secure. Defaults to False.

returns () - The data type of the return value.

execute_as () - The execution rights. Defaults to ExecutionRights.CALLER.

null_handling () - How nulls are handled. Defaults to NullHandling.CALLED_ON_NULL_INPUT.

owner (string or ) - The owner of the procedure. Defaults to "SYSADMIN".

Snowflake Documentation
DataType
ExecutionRights
NullHandling
Role