All Products
Search
Document Center

Object Storage Service:Create a table

Last Updated:May 08, 2026

Creates an Iceberg table in the specified table bucket and namespace.

Notes

  • Table names must contain only lowercase letters, numbers, and underscores (_) and must start and end with a lowercase letter or a number.

  • Table names must be unique within a namespace.

  • The --metadata parameter requires table metadata in JSON format to define the Iceberg table's schema. You can provide the JSON inline or from a local file by using the file:// prefix.

  • Currently, the --format parameter only supports ICEBERG.

Syntax

ossutil tables-api create-table --table-bucket-arn value --namespace value --name value --format value  [flags]

Parameter

Type

Description

--encryption-configuration

string

Specifies the server-side encryption method for the table. Provide the configuration in JSON format.

--format

string

Specifies the table format. Currently, only ICEBERG is supported.

--metadata

string

Specifies the table metadata in JSON format. This metadata defines the Iceberg table's schema, including field information.

--name

string

Specifies the table name. The name can contain only lowercase letters, numbers, and underscores (_), and must start and end with a lowercase letter or a number.

--namespace

string

The namespace in which the table is to be created.

--table-bucket-arn

string

The Alibaba Cloud Resource Name (ARN) of the table bucket. The format is acs:osstables:{region}:{uid}:bucket/{bucket-name}.

Note

The JSON syntax for the --metadata parameter is as follows:

{
  "iceberg": {
    "schema": {
      "fields": [
        {
          "id": 1,
          "name": "id",
          "type": "long",
          "required": true
        },
        {
          "id": 2,
          "name": "name",
          "type": "string",
          "required": false
        },
        {
          "id": 3,
          "name": "created_at",
          "type": "timestamp",
          "required": false
        }
      ]
    }
  }
}

The attributes for each field are as follows:

  • id: The field ID. Must be a unique and incremental integer.

  • name: The name of the field.

  • type: The data type of the field. Supported Iceberg types include long, string, int, boolean, float, double, and timestamp.

  • required: A boolean value that specifies whether the field is required. If true, the field cannot be null.

Examples

  • Create an Iceberg table named my_table in the my_namespace namespace and provide the table schema as inline JSON.

    ossutil tables-api create-table --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --format ICEBERG --metadata '{"iceberg":{"schema":{"fields":[{"id":1,"name":"id","type":"long","required":true},{"id":2,"name":"data","type":"string"}]}}}'
  • Create an Iceberg table from a local JSON file. First, save the table metadata to a file named table_metadata.json. Then, specify the file path with the file:// prefix.

    ossutil tables-api create-table --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --format ICEBERG --metadata file://table_metadata.json