BUILD_STAGE_FILE_URL

functionsupportedData loading & unloading

docs.snowflake.com ↗

File functions

Generates a Snowflake file URL to a staged file using the stage name and relative file path as inputs. A file URL permits prolonged access to a specified file. That is, the file URL does not expire. Call this SQL function in a query, user-defined function (UDF), or stored procedure. Access files in a stage by sending the file URL in a request to the REST API for file support. When users send a file URL to the REST API to access files, Snowflake performs the following actions: - Authenticate the user. - Verify that the role has sufficient privileges on the stage that contains the file. - Redirect the user to the staged file in the cloud storage service.

Syntax

BUILD_STAGE_FILE_URL( @<stage_name> , '<relative_file_path>' )

Parameters

NameRequiredDescription
stage_namerequiredName of the internal or external stage where the file is stored. Note If the stage name includes spaces or special characters, it must be enclosed in single quotes (e.g. '@"my stage"' for a stage named "my stage").
relative_file_pathrequiredPath and filename of the file relative to its location in the stage.

Returns

The function returns a file URL in the following format: Where:

Usage notes