All Products
Search
Document Center

MaxCompute:ADD TABLE

Last Updated:Jul 25, 2024

Adds TABLE resources to a MaxCompute project.

Limits

  • MaxCompute does not allow you to add external tables as resources.

  • Schema evolution is not allowed for tables that are added as resources. If a schema evolution is performed on a table that is added as a resource, you must add the table as a resource again.

  • The size of each resource file cannot exceed 2,048 MB. 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 be executed only on the MaxCompute client (odpscmd).

Syntax

add table <table_name> [partition (<spec>)] [as <alias>] [comment '<comment>'][-f];

Parameters

  • Resource type:

    table: required. The resource type. For more information about resource types, see Resource.

  • Common parameters

    • table_name: required. The name of a table in MaxCompute.

    • spec: required. If the resource that you want to add is a partitioned table, MaxCompute takes only a partition in the table as a resource, instead of taking the whole table as 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

Add a partitioned table whose alias is sale.res as a resource to a MaxCompute project.

add table sale_detail partition (ds='20150602') as sale.res comment 'sale detail on 20150602' -f;

The following result is returned:

OK: Resource 'sale.res' have been updated.

Related statements