stages
Creates, updates, deletes, gets or lists a stages
resource.
Overview
Name | stages |
Type | Resource |
Id | snowflake.stage.stages |
Fields
Name | Datatype | Description |
---|---|---|
name | string | A Snowflake object identifier. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive. |
cloud | string | Cloud provider; always NULL for an internal stage. |
comment | string | Specifies a comment for the stage. |
created_on | string | Date and time when the stage was created. |
credentials | object | Specifies the credentials of the stage. |
directory_table | object | Directory table parameters of the stage. |
encryption | object | Encryption parameters of the stage. |
endpoint | string | The S3-compatible API endpoint associated with the stage; always NULL for stages that are not S3-compatible. |
has_credentials | boolean | Indicates that the external stage has access credentials; always false for an internal stage. |
has_encryption_key | boolean | Indicates that the external stage contains encrypted files; always false for an internal stage. |
kind | string | Specifies whether the stage is permanent or temporary. |
owner | string | Role that owns the stage. |
owner_role_type | string | The type of role that owns the object, either ROLE or DATABASE_ROLE. If a Snowflake Native App owns the object, the value is APPLICATION. Snowflake returns NULL if you delete the object because a deleted object does not have an owner role. |
region | string | Region where the stage is located. |
storage_integration | string | A Snowflake object identifier. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive. |
url | string | URL for the external stage; blank for an internal stage. |
Methods
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
fetch_stage | SELECT | database_name, name, schema_name, endpoint | - | Fetch a stage using the describe command output. |
list_stages | SELECT | database_name, schema_name, endpoint | like | Lists stages under the database and schema, with show options as query parameters. |
create_stage | INSERT | database_name, schema_name, data__name, endpoint | createMode | Create a stage, with standard create modifiers as query parameters. See the Stage component definition for what is required to be provided in the request body. |
delete_stage | DELETE | database_name, name, schema_name, endpoint | ifExists | Delete a stage with the stage name. If ifExists is used, the operation will succeed even if the object does not exist. Otherwise, there will be a failure if the drop is unsuccessful. |
Optional Parameter Details
Name | Description | Type | Default |
---|---|---|---|
createMode | Query parameter allowing support for different modes of resource creation. Possible values include: - errorIfExists : Throws an error if you try to create a resource that already exists. - orReplace : Automatically replaces the existing resource with the current one. - ifNotExists : Creates a new resource when an alter is requested for a non-existent resource. | string | errorIfExists |
ifExists | Query parameter that specifies how to handle the request for a resource that does not exist: - true : The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource. - false : The endpoint throws an error if the resource doesn't exist. | boolean | false |
like | Query parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. | string | - |
SELECT
examples
- list_stages
- fetch_stage
Lists stages under the database and schema, with show options as query parameters.
SELECT
name,
cloud,
comment,
created_on,
credentials,
directory_table,
encryption,
endpoint,
has_credentials,
has_encryption_key,
kind,
owner,
owner_role_type,
region,
storage_integration,
url
FROM snowflake.stage.stages
WHERE database_name = '{{ database_name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';
Fetch a stage using the describe command output.
SELECT
name,
cloud,
comment,
created_on,
credentials,
directory_table,
encryption,
endpoint,
has_credentials,
has_encryption_key,
kind,
owner,
owner_role_type,
region,
storage_integration,
url
FROM snowflake.stage.stages
WHERE database_name = '{{ database_name }}'
AND name = '{{ name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';
INSERT
example
Create a stage, with standard create modifiers as query parameters. See the Stage component definition for what is required to be provided in the request body.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO snowflake.stage.stages (
data__name,
data__kind,
data__url,
data__endpoint,
data__storage_integration,
data__comment,
data__credentials,
data__encryption,
data__directory_table,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ kind }}',
'{{ url }}',
'{{ endpoint }}',
'{{ storage_integration }}',
'{{ comment }}',
'{{ credentials }}',
'{{ encryption }}',
'{{ directory_table }}',
'{{ database_name }}',
'{{ schema_name }}'
;
/*+ create */
INSERT INTO snowflake.stage.stages (
data__name,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
# Description fields below are for documentation purposes only and are not required in the manifest
- name: stages
props:
- name: database_name
value: string
description: Required parameter for the stages resource.
- name: schema_name
value: string
description: Required parameter for the stages resource.
- name: endpoint
value: string
description: Required parameter for the stages resource.
- name: name
value: string
description: >-
A Snowflake object identifier. If the identifier contains spaces or
special characters, the entire string must be enclosed in double quotes.
Identifiers enclosed in double quotes are also case-sensitive. (Required
parameter for the stages resource.)
- name: kind
value: string
description: >-
Specifies whether the stage is permanent or temporary. (valid values:
'PERMANENT', 'TEMPORARY')
default: PERMANENT
- name: url
value: string
description: URL for the external stage; blank for an internal stage.
- name: endpoint
value: string
description: >-
The S3-compatible API endpoint associated with the stage; always NULL
for stages that are not S3-compatible.
- name: storage_integration
value: string
description: >-
A Snowflake object identifier. If the identifier contains spaces or
special characters, the entire string must be enclosed in double quotes.
Identifiers enclosed in double quotes are also case-sensitive.
- name: comment
value: string
description: Specifies a comment for the stage.
- name: credentials
value:
credential_type: string
description: Specifies the credentials of the stage.
- name: encryption
value:
type: string
master_key: string
kms_key_id: string
description: Encryption parameters of the stage.
- name: directory_table
value:
enable: boolean
refresh_on_create: boolean
auto_refresh: boolean
notification_integration: string
description: Directory table parameters of the stage.
DELETE
example
Delete a stage with the stage name. If ifExists is used, the operation will succeed even if the object does not exist. Otherwise, there will be a failure if the drop is unsuccessful.
/*+ delete */
DELETE FROM snowflake.stage.stages
WHERE database_name = '{{ database_name }}'
AND name = '{{ name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';