Skip to main content

stage_files

Creates, updates, deletes, gets or lists a stage_files resource.

Overview

Namestage_files
TypeResource
Idsnowflake.pipelines.stage_files

Fields

The following fields are returned by SELECT queries:

A file on a snowflake stage.

NameDatatypeDescription
namestringName of the file.
last_modifiedstringDate and time when the file was last modified.
md5stringmd5 hash of the file.
sizestringSize of the file.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectdatabase_name, schema_name, name, endpointpatternList files in the stage -- this is equivalent to LIST @stage.
presigned_urlexecdatabase_name, schema_name, name, file_path, endpointGenerate 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.

NameDatatypeDescription
database_namestringIdentifier (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.
endpointstringOrganization and account identifier (orgname-accountname) (default: orgname-accountname)
file_pathstringThe full stage path of the file.
namestringIdentifier (i.e. name) for the resource.
schema_namestringIdentifier (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.
patternstringParameter that filters the command output by a regular expression pattern.

SELECT examples

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

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 }}
}'
;