Adds an archive file as a resource.
Limitations
-
External tables cannot be added as resources.
-
Schema evolution is not supported for tables added as resources. If schema evolution is performed on such a table, re-add the table as a resource.
-
Each resource file cannot exceed 2,048 MB. Resources referenced by a single SQL or MapReduce job cannot exceed 2,048 MB in total.
-
This is a CMD statement and can only be run on the MaxCompute client (odpscmd).
Syntax
add archive <local_file> [as <alias>] [comment '<comment>'] [-f];
Parameters
Resource type parameter
-
archive: Required. Specifies the resource type. For a full list of resource types, see Resource.
Common parameters
| Parameter | Required | Description |
|---|---|---|
local_file |
Yes | Path of the local archive file to add. The file name is used as the resource name, which uniquely identifies the resource. |
alias |
No | Custom name for the resource. If not specified, the file name is used. JAR packages and Python script files do not support this parameter. |
comment |
No | Comment for the resource. |
-f |
No | If a resource with the same name already exists, replaces it. Without this flag, adding a resource with a duplicate name fails. |
Examples
Add a .zip archive as a resource using the file name as the resource name:
add archive /tmp/mydata.zip;
Add a .tar.gz archive with a custom alias:
add archive /tmp/mydata.tar.gz as myarchive;
Replace an existing resource that has the same name:
add archive /tmp/mydata.zip -f;
What's next
-
ADD FILE: Add a file as a resource.
-
ADD JAR: Add a JAR file as a resource.
-
ADD PY: Add Python code as a resource.
-
ADD TABLE: Add a table as a resource.
-
ALIAS: Create an alias for a resource.
-
DESC RESOURCE: View information about a resource.
-
LIST RESOURCES: List all resources in a project.
-
GET RESOURCE: Download a resource.
-
DROP RESOURCE: Delete a resource.