TRY_TO_FILE

functionsupportedData loading & unloading

docs.snowflake.com ↗

File functions

A version of TO_FILE that returns NULL instead of raising an error.

Syntax

Use one of the following

TRY_TO_FILE( <stage_name>, <relative_path> )

TRY_TO_FILE( <file_url> )

TRY_TO_FILE( <metadata> )

Parameters

NameRequiredDescription
stage_namerequiredThe name of the stage where the file is located, as a string, in the form '@stage_name'.
relative_pathrequiredThe path to the file on the stage specified by stage_name as a string.
file_urlrequiredA valid stage or scoped file URL as a string.
metadatarequiredAn OBJECT containing the required FILE attributes. A FILE must have CONTENT_TYPE, SIZE, ETAG, and LAST_MODIFIED fields. It must also specify the file’s location in one of the following ways: Both STAGE and RELATIVE_PATH STAGE_FILE_URL SCOPED_FILE_URL

Returns

A FILE, or NULL.

Usage notes