All Products
Search
Document Center

Object Storage Service:Create a table

Last Updated:Jun 02, 2026

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

Notes

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

  • Table names must be unique within a namespace.

  • The --metadata parameter accepts JSON that defines the Iceberg table schema. Provide JSON inline or reference a local file with the file:// prefix.

  • The --format parameter supports only ICEBERG.

Syntax

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

Parameter

Type

Description

--encryption-configuration

string

Server-side encryption configuration for the table, in JSON format.

--format

string

Table format. Only ICEBERG is supported.

--metadata

string

Table metadata in JSON format. Defines the Iceberg table schema and field information.

--name

string

Table name. Must contain only lowercase letters, digits, and underscores (_), and start and end with a lowercase letter or digit.

--namespace

string

Target namespace for the table.

--table-bucket-arn

string

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

Note

JSON syntax for --metadata:

{
  "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
        }
      ]
    }
  }
}

Field attributes:

  • id: Unique incremental integer.

  • name: Field name.

  • type: Data type. Supported types: long, string, int, boolean, float, double, and timestamp.

  • required: 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 with an inline JSON schema.

    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 metadata file. Save the schema to table_metadata.json, then reference it 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