Skip to main content

Stage

You can provide configuration to Snowflake Object Lifecycle Engine for the following operations with stage:

  • Manage the lifecycle of new and existing stages
  • Manage the grants of a stage

Usage

note

We have introduced SOLE for Data Products as a new framework for SOLE to help you easily build an ecosystem of data products. Learn more about SOLE for Data Products which is currently available as a private preview.

databases:
<database-name>:
schemas:
<schema-name>:
stages:
<stage-name>:
<configuration-key>: <value>

Supported parameters

The engine supports the parameters listed below.

Configuration KeyRequired/OptionalData Types and ValuesDescription
commentOptionalStringSpecifies a comment for the stage
copy_optionsOptionalString: See here for a definition of copy_optionsSpecifies one (or more) copy options for the stage. See the Snowflake doc section for copy options.
credentialsOptionalStringSpecifies the credentials for the stage, required only if the storage location is private/protected - not required for public buckets/containers
deletedOptionalBoolean: True enables deletion prevention, False does nothingSpecifies what objects are allowed to be deleted
directoryOptionalString: See here for a definition of directorySpecifies the directory settings for the stage. See the Snowflake doc section for more info.
encryptionOptionalStringRequired only for loading from/unloading into encrypted files and not required if storage location and files are decrypted
file_formatOptionalString/Map: See here for a definition of file_formatSpecifies the file format for the stage.
Note: A change will always be detected for the file_format parameter in subsequent pipeline runs even when there isn't any in the case of:
- Object names having lowercase characters or containing special characters in the parameter.
- Specifying any format option(s) with a value set to its default value.
grantsOptionalMap: See Supported Stage Grants to RolesList of Privileges and Roles to which privileges are granted on the current stage
manage_modeOptionalString: all (default), none, grantsConfigures what properties to manage for the stage.
See Changing Manage Mode before changing the value.
storage_integrationOptionalStringSpecifies the name of the storage integration used to delegate authentication responsibility for external cloud storage to a Snowflake identity and access management (IAM) entity. See Storage Integration Usage for more info.
URLOptionalStringSpecifies the URL for the stage. See Storage Integration Usage for more info.
caution

During subsequent pipeline runs a force-replacement behavior might be observed in PLAN and APPLY phases for a few parameters like directory.

Storage integration usage

A Storage Integration can be specified in an external stage if Access is managed via storage integration.

In the configuration of Storage Integration, paths to allow external storage can be specified as well. If such paths have been specified, then the stage using the Storage Integration must have the value of parameter URL as one of the allowed paths.

In the event, that both Storage Integration and Stage are being updated, an error could occur due to an invalid URL parameter.
To resolve such an error, apply the following procedure:

  • Disable the stage (comment out the definition in the configuration) and its dependencies and run a pipeline. This would delete the stage from the environment.
  • Enable the stage (uncomment the definition) with updated configuration and run the pipeline again to initialize the stage from scratch.

Supported stage grants to roles

Following are the privileges you can grant to roles in the stage definition:

  • ALL PRIVILEGES
  • OWNERSHIP
  • USAGE
    • Only for External Stage
  • READ
    • Only for Internal Stage
  • WRITE
    • Only for Internal Stage

Implicit READ for internal stage

If Only WRITE is granted to a Role, READ privilege is implicitly added as well.

directory parameters

The Directory parameter supports the following parameters.

Configuration KeyRequired/OptionalData Types and Values
auto_refreshOptionalBoolean
enableOptionalBoolean
notification_integrationOptionalString
refresh_on_createOptionalBoolean
note

The below parameters are supported in the directory parameter based on the type of stage and storage provider:

  • For Internal stages: enable
  • For External Stage
    • For Amazon S3: enable, auto_refresh and refresh_on_create
    • For Google Cloud Storage and Microsoft Azure: enable, auto_refresh, refresh_on_create and notification_integration :::

Examples

directory parameter

for internal stages

databases:
SALES_RECORD:
comment: "product sales record"
schemas:
SALES_SCHEMA:
comment: "sales records for year 2021"
stages:
INTERNAL_STAGE:
comment: "files stage"
directory:
enable: true

for Amazon S3

databases:
SALES_RECORD:
comment: "product sales record"
schemas:
SALES_SCHEMA:
comment: "sales records for year 2021"
stages:
S3_STAGE:
url: "s3://{{AWS.DATAOPS.STAGING.S3_BUCKET}}"
credentials: "AWS_KEY_ID='{{AWS.DATAOPS.STAGING.ACCESS_KEY_ID}}' AWS_SECRET_KEY='{{AWS.DATAOPS.STAGING.SECRET_ACCESS_KEY}}'"
directory:
enable: true
auto_refresh: true
refresh_on_create: true

for Google cloud storage

databases:
SALES_RECORD:
comment: "product sales record"
schemas:
SALES_SCHEMA:
comment: "sales records for year 2021"
stages:
GCS_STAGE:
url: "gcs://load/files/"
storage_integration: "my_storage_int"
directory:
enable: true
auto_refresh: true
refresh_on_create: true
notification_integration: "MY_NOTIFICATION_INT"

for Microsoft Azure

databases:
SALES_RECORD:
comment: "product sales record"
schemas:
SALES_SCHEMA:
comment: "sales records for year 2021"
stages:
AZURE_STAGE:
url: "azure://account.blob.core.windows.net/load/files"
storage_integration: "my_storage_int"
directory:
enable: true
auto_refresh: true
refresh_on_create: true
notification_integration: "MY_NOTIFICATION_INT"