Adds a file as a resource to a MaxCompute project.
Limits
- MaxCompute does not allow you to add external tables as resources.
- The size of each resource file cannot exceed 2048 MB. The version of the MaxCompute client (odpscmd) must be 0.37.5 or later. The size of resources referenced by a single SQL or MapReduce job cannot exceed 2,048 MB.
- This statement is a CMD statement and can only be executed on the MaxCompute client (odpscmd).
Syntax
add file <local_file> [as <alias>] [comment '<comment>'][-f];
Parameters
- Resource type:
file: required. The resource type. For more information about resource types, see Resource.
Common parameters
local_file: required. The path of the file that you want to add. The file name is used as the resource name, which uniquely identifies a resource.
alias: optional. The name of the resource. If this parameter is not specified, the file name is used as the resource name. JAR packages or Python script files that are used as resources do not support this parameter.
comment: optional. The comment of the resource.
-f: optional. If a duplicate resource name exists, the existing resource is replaced. If you do not specify this option and a duplicate resource name exists, the resource fails to be added.
Examples
Sample statement:add file banking.txt;
The following result is returned: OK: Resource 'banking.txt' have been created.
Related statements
- ADD ARCHIVE: Adds an archive file as a resource.
- ADD JAR: Adds a JAR file as a resource.
- ADD PY: Adds Python code as a resource.
- ADD TABLE: Adds a table as a resource.
- DESC RESOURCE: Views information about a resource.
- LIST RESOURCES: Views the information about resources.
- ALIAS: Creates an alias for a resource.
- GET RESOURCE: Downloads a resource.
- DROP RESOURCE: Deletes a resource.