BUILD_SCOPED_FILE_URL

functionsupportedData loading & unloading

docs.snowflake.com ↗

File functions

Generates a scoped Snowflake file URL to a staged file using the stage name and relative file path as inputs. A scoped URL is encoded and permits access to a specified file for a limited period of time. The scoped URL in the output is valid for the caller until the persisted query result period ends (until the results cache expires). That period is currently 24 hours. Call this SQL function in a query or view. You can also use this SQL function to pass a scoped URL to a user-defined function (UDF) or stored procedure.

Syntax

BUILD_SCOPED_FILE_URL(
  @<stage_name> ,
  '<relative_file_path>' ,
  <use_privatelink_host_for_business_critical>)

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 (for example, '@"my stage"' for a stage named "my stage").
relative_file_pathrequiredPath and filename of the file, relative to its location on the stage.
use_privatelink_host_for_business_criticalrequiredSpecifies whether to prepend privatelink to the URL for Business Critical accounts. TRUE prepends privatelink to the URL just before the hostname; for example, privatelink.snowflakecomputing.com. Note Snowflake prepends privatelink to the URL regardless of whether you’ve enabled private connectivity. FALSE overrides the default behavior and does not add privatelink to the URL. Default: TRUE

Returns

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

Usage notes