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 | 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 | Lists stages under the database and schema, with show options as query parameters. |
create_stage | INSERT | database_name, schema_name, data__name, endpoint | 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 | 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. |
SELECT
examples
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 }}';
INSERT
example
Use the following StackQL query and manifest file to create a new stages
resource.
- 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 }}'
;
- name: stages
props:
- name: database_name
value: string
- name: schema_name
value: string
- name: data__name
value: string
- name: endpoint
value: string
- name: name
value: string
- name: kind
value: string
- name: url
value: string
- name: endpoint
value: string
- name: storage_integration
value: string
- name: comment
value: string
- name: credentials
props:
- name: credential_type
value: string
- name: encryption
props:
- name: type
value: string
- name: master_key
value: string
- name: kms_key_id
value: string
- name: directory_table
props:
- name: enable
value: boolean
- name: refresh_on_create
value: boolean
- name: auto_refresh
value: boolean
- name: notification_integration
value: string
DELETE
example
Deletes the specified stages
resource.
/*+ delete */
DELETE FROM snowflake.stage.stages
WHERE database_name = '{{ database_name }}'
AND name = '{{ name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';