GET_PRESIGNED_URL Function
This function generates a presigned URL for a file in a Volume by inputting the Volume name, the relative path of the file, and the expiration time (in seconds). This feature allows applications to access files stored in an external Volume.
Usage Scenarios
Here are several methods to access files in a Volume:
- Directly access the presigned URL in a web browser.
- Send the presigned URL of the Volume file to a remote function for processing.
Notes
-
The user executing this function needs to have READ permission on the Volume object.
-
This function needs to obtain file information (such as
relative_path
) from the local metadata system of the Volume. Please ensure that the file metadata corresponding to the newly imported Volume has been synchronized to the Lakehouse metadata system, or use the following command to refresh: -
GET_PRESIGNED_URL is a non-deterministic function, meaning that given the same input values, the output may be different each time it is executed.
Syntax
Parameters
- volume <volume_name>: volume is a fixed keyword, indicating that the following object type is Volume; volume_name is the name of the Volume created by the system.
- relative_file_path: The file path and file name relative to the specified location of the Volume. It can be obtained by calling the directory function:
- expiration_time: The validity period of the generated URL, in seconds. The default value is 3600 seconds (60 minutes).
Return Value
The pre-signed URL.
Usage Example
Here are some examples of using the GET_PRESIGNED_URL function:
- Generate a pre-signed URL with a validity period of 1 hour:
- Generate a pre-signed URL with a default validity period (1 hour):
By the above example, you can better understand how to use the GET_PRESIGNED_URL function in different scenarios. Please adjust the parameters and code according to your actual needs.