This topic describes how to use common commands to manage resources on the MaxCompute client.

You can also search and upload resources by using the visualized online data development tools offered in DataWorks. For more information, see Resource.

Add a resource

add file <local_file> [as alias] [comment 'cmt'][-f];
add archive <local_file> [as alias] [comment 'cmt'][-f];
add table <table_name> [partition (spec)] [as alias] [comment 'cmt'][-f];
add <PY | JAR> <localfile[.py |.jar]> [COMMENT 'cmt'][-f];


Adds a resource to MaxCompute.

  • file/archive/table/jar/py: specifies the resource type. For more information, see Resource.
  • local_file: specifies the path of the local file. The file name is used as the resource name, which uniquely identifies a resource.
  • table_name: specifies the table name in MaxCompute. External tables cannot be added as resources.
  • [partition (spec)]: If the resource you want to add is a partitioned table, MaxCompute considers only a partition as a resource, not the entire partitioned table.
  • alias: specifies a resource name. If this parameter is not specified, the file name is used as a resource name by default. Jar and Python resources do not support this parameter.
  • [comment'cmt']: adds a comment to a resource.
  • [-f]: overwrites the original resource that has the same name as the current resource. If this parameter is not specified and a duplicate resource name exists, the operation fails.
-- Add a partitioned table resource named sale.res to MaxCompute.
odps@ odps_public_dev>add table sale_detail partition (ds='20150602') as sale.res comment 'sale detail on 20150602' -f;
OK: Resource 'sale.res' have been updated.
Note The size of each resource file cannot exceed 500 MB. The resource size referenced by a single SQL or MapReduce task cannot exceed 2,048 MB. For more limits, see Limits.

View a resource list



Views all resources in the current project.

odps@ $project_name>list resources;
Resource Name      Comment      Last Modified Time        Type
1234.txt                        2014-02-27 07:07:56       file
mapred.jar                      2014-02-27 07:07:57       jar

Download resources

GET RESOURCE <resource_name> <path>;


Downloads MaxCompute resources to your local device. The resource type must be FILE, JAR, ARCHIVE, or PY.

  • resource_name: specifies the name of the resource you want to download.
  • path: specifies the path used to save a resource to your local device.
odps@ $project_name>get resource odps-udf-examples.jar d:\;

Remove a resource

DROP RESOURCE <resource_name>; 


Removes an existing resource.


resource_name: specifies the name of the resource you want to remove. The resource name is specified when you create the resource.