PUT Command
Description
The PUT command is a utility in Lakehouse SQL used to upload local files from the client host to the data lake Volume object in Lakehouse. With this command, users can easily transfer local files to the cloud, achieving rapid data migration and synchronization. To execute the PUT command, you can use the sqlline tool or database management tools.
Usage Scenarios
The PUT command is suitable for the following scenarios:
- Uploading local files to the data lake Volume object.
- Rapid migration and synchronization of local and cloud data.
Syntax
Parameter Description
: The path of the local file to be uploaded. Linux / macOS: The path starts with the root directory '/' or uses thelocal_path
prefix to indicate the local path. Windows System: If the directory path and/or file name contains special characters, the entire file URI must be enclosed in single quotes. Note that within the enclosed URI, the separator is a forward slash ('/').'file:///'
: Refer to uploading local data to external Volume, TABLE VOLUME, and USER VOLUME respectively.VOLUME/TABLE VOLUME/USER VOLUME
: Specifies the target path for the uploaded file. You can specify a subdirectory (SUBDIRECTORY/FILE
) or use the FILE parameter to rename the uploaded file.SUBDIRECTORY
Example
- Use internal volume to upload files to the table
- Create an external volume object named
and upload the filehz_image_volume'/Users/derekmeng/Downloads/cats_and_dogs.zip' - There is a table named
, and you want to upload the local table data to the table's volume space:tbl_region
Notes
- The PUT command cannot be executed through the Studio SQL task node. Users can execute this command through the Lakehouse SQLLine client, JDBC client, and SDK.
- Please ensure that the size of a single file to be uploaded does not exceed 5G.
- When using the PUT command, please ensure that the local file path and file name are correct to avoid upload failures due to incorrect paths.
- When uploading files, if a file with the same name already exists in the target volume object, the system will automatically overwrite the original file. If necessary, please perform the appropriate backup operations before uploading.
