FL_GET_STAGE_FILE_URL¶
Returns the stage URL of a FILE.
Syntax¶
Use one of the following:
FL_GET_STAGE_FILE_URL( <scoped_url> ) FL_GET_STAGE_FILE_URL( <metadata> )
Arguments¶
scoped_url
A valid scoped file URL.
metadata
An OBJECT containing all the required FILE metadata.
Returns¶
The URL of the file as a VARCHAR.
Examples¶
Example using an input FILE:
CREATE TABLE file_table(f FILE);
INSERT INTO file_table SELECT TO_FILE(BUILD_STAGE_FILE_URL('@mystage', 'image.png'));
SELECT FL_GET_STAGE_FILE_URL(f) FROM file_table;
+-------------------------------------------------------------------------------------------+
| FL_GET_STAGE_FILE_URL(F) |
|-------------------------------------------------------------------------------------------|
| https://snowflake.account.snowflakecomputing.com/api/files/TEST/PUBLIC/MYSTAGE/image.png |
+-------------------------------------------------------------------------------------------+
Example using an input OBJECT:
CREATE TABLE file_table(f OBJECT);
INSERT INTO file_table SELECT OBJECT_CONSTRUCT('STAGE_FILE_URL', 'https://snowflake.account.snowflakecomputing.com/api/files/TEST/PUBLIC/MYSTAGE/image.png',
'ETAG', '<ETAG value>', 'LAST_MODIFIED', 'Wed, 11 Dec 2024 20:24:00 GMT', 'SIZE', 105859, 'CONTENT_TYPE', 'image/jpg');
SELECT FL_GET_STAGE_FILE_URL(f) FROM file_table;
+-------------------------------------------------------------------------------------------+
| FL_GET_STAGE_FILE_URL(F) |
|-------------------------------------------------------------------------------------------|
| https://snowflake.account.snowflakecomputing.com/api/files/TEST/PUBLIC/MYSTAGE/image.png |
+-------------------------------------------------------------------------------------------+