stages
Creates, updates, deletes, gets or lists a stages
resource.
Overview
Name | stages |
Type | Resource |
Id | snowflake.stage.stages |
Fields
The following fields are returned by SELECT
queries:
- list_stages
- fetch_stage
A Snowflake stage.
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. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$, example: TEST_NAME) |
cloud | string | Cloud provider; always NULL for an internal stage. |
comment | string | Specifies a comment for the stage. |
created_on | string (date-time) | 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. (default: PERMANENT) |
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. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$, example: TEST_NAME) |
url | string | URL for the external stage; blank for an internal stage. |
A Snowflake stage.
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. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$, example: TEST_NAME) |
cloud | string | Cloud provider; always NULL for an internal stage. |
comment | string | Specifies a comment for the stage. |
created_on | string (date-time) | 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. (default: PERMANENT) |
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. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$, example: TEST_NAME) |
url | string | URL for the external stage; blank for an internal stage. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
list_stages | select | database_name , schema_name , endpoint | like | Lists stages under the database and schema, with show options as query parameters. |
fetch_stage | select | database_name , schema_name , name , endpoint | Fetch a stage using the describe command output. | |
create_stage | insert | database_name , schema_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 , schema_name , 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. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
database_name | string | Identifier (i.e. name) for the database to which the resource belongs. You can use the /api/v2/databases GET request to get a list of available databases. |
endpoint | string | Organization and Account Name (default: orgid-acctid) |
name | string | Identifier (i.e. name) for the resource. |
schema_name | string | Identifier (i.e. name) for the schema to which the resource belongs. You can use the /api/v2/databases/{database}/schemas GET request to get a list of available schemas for the specified database. |
createMode | string | 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. |
ifExists | boolean | 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. |
like | string | Query parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. |
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 }}' -- required
AND schema_name = '{{ schema_name }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND like = '{{ like }}';
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 }}' -- required
AND schema_name = '{{ schema_name }}' -- required
AND name = '{{ name }}' -- required
AND endpoint = '{{ endpoint }}' -- required;
INSERT
examples
- create_stage
- Manifest
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.
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,
createMode
)
SELECT
'{{ name }}' --required,
'{{ kind }}',
'{{ url }}',
'{{ endpoint }}',
'{{ storage_integration }}',
'{{ comment }}',
'{{ credentials }}',
'{{ encryption }}',
'{{ directory_table }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}',
'{{ createMode }}'
;
# Description fields are for documentation purposes
- 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.
- 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: object
description: >
Specifies the credentials of the stage.
- name: encryption
value: object
description: >
Encryption parameters of the stage.
- name: directory_table
value: object
description: >
Directory table parameters of the stage.
- name: createMode
value: string
description: 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.
DELETE
examples
- delete_stage
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 FROM snowflake.stage.stages
WHERE database_name = '{{ database_name }}' --required
AND schema_name = '{{ schema_name }}' --required
AND name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND ifExists = '{{ ifExists }}';