stage_files
Creates, updates, deletes, gets or lists a stage_files resource.
Overview
| Name | stage_files |
| Type | Resource |
| Id | snowflake.pipelines.stage_files |
Fields
The following fields are returned by SELECT queries:
- list
A file on a snowflake stage.
| Name | Datatype | Description |
|---|---|---|
name | string | Name of the file. |
last_modified | string | Date and time when the file was last modified. |
md5 | string | md5 hash of the file. |
size | string | Size of the file. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | database_name, schema_name, name, endpoint | pattern | List files in the stage -- this is equivalent to LIST @stage. |
presigned_url | exec | database_name, schema_name, name, file_path, endpoint | Generate a presigned url and optionally encryption materials for uploading and downloading files. |
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 identifier (orgname-accountname) (default: orgname-accountname) |
file_path | string | The full stage path of the file. |
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. |
pattern | string | Parameter that filters the command output by a regular expression pattern. |
SELECT examples
- list
List files in the stage -- this is equivalent to LIST @stage.
SELECT
name,
last_modified,
md5,
size
FROM snowflake.pipelines.stage_files
WHERE database_name = '{{ database_name }}' -- required
AND schema_name = '{{ schema_name }}' -- required
AND name = '{{ name }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND pattern = '{{ pattern }}'
;
Lifecycle Methods
- presigned_url
Generate a presigned url and optionally encryption materials for uploading and downloading files.
EXEC snowflake.pipelines.stage_files.presigned_url
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@file_path='{{ file_path }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"expiration_time": {{ expiration_time }}
}'
;