Categories:

File Functions

GET_STAGE_LOCATION

Retrieves the URL for an external or internal named stage using the stage name as the input.

Syntax

GET_STAGE_LOCATION( @<stage_name> )

Arguments

stage_name

Name of an external or internal named stage.

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").

Usage Notes

This SQL function returns a value for any role that has the USAGE privilege on the stage.

Output

URL of the cloud storage location in the stage definition.

Examples

Retrieve the URL for an external stage:

CREATE STAGE images_stage URL = 's3://photos/national_parks/us/yosemite/';

SELECT GET_STAGE_LOCATION(@images_stage);

+----------------------------------------------------------+
| GET_STAGE_LOCATION(@IMAGES_STAGE)                        |
+----------------------------------------------------------+
| s3://photos/national_parks/us/yosemite/                  |
+----------------------------------------------------------+