mc table create

The mc table create command creates a new Iceberg table on a MinIO AIStor cluster.

Tables are created within a namespace and can have custom properties.

Parameters

ALIAS

Required

The alias of a MinIO AIStor cluster on which to create the table.

NAMESPACE

Required

The name of the namespace in which to create the table.

TABLE

Required

The name of the table to create.

WAREHOUSE

Required

The name of the warehouse containing the target namespace.

--schema

Required

A JSON schema definition for the table. The schema follows the Iceberg schema specification with type definitions and field properties.

Example:

{"type":"struct","fields":[{"id":1,"name":"id","type":"long","required":true}]}

--attr

Alias: -a

Optional

Add a custom property for the table in key=value format. You can specify multiple --attr parameters to add multiple properties.

--partition

Optional

A JSON partition spec for the table, following the Iceberg partition specification.

Example:

{"spec-id":0,"fields":[{"source-id":2,"field-id":1000,"name":"category","transform":"identity"}]}

Each entry in fields refers to a schema field by its source-id.

--sse-s3

Optional

Enables SSE-S3 server-side encryption for the table.

Mutually exclusive with --sse-kms. Do not combine it with --sse-kms-key-id.

--sse-kms

Optional

Enables SSE-KMS server-side encryption for the table.

Requires --sse-kms-key-id. Mutually exclusive with --sse-s3.

--sse-kms-key-id

Optional

The KMS key ID to use for SSE-KMS encryption.

Required when you specify --sse-kms, and not valid without it.

--ignore-existing

Alias: -p

Optional

Do not return an error if a table with the specified name already exists.

Global flags

This command supports any of the global flags.

Examples

Create a table with a schema

Use mc table create to create a new table:

mc table create ALIAS WAREHOUSE NAMESPACE TABLE                   \
   --schema '{"type":"struct","fields":[{"id":1,"name":"id","type":"long","required":true}]}'
  • Replace ALIAS with the alias of the MinIO AIStor cluster.
  • Replace WAREHOUSE with the name of the warehouse.
  • Replace NAMESPACE with the name of the namespace.
  • Replace TABLE with the name for the new table.

Create a table with custom properties

Use the --attr flag to add custom properties when creating a table:

mc table create myaistor analytics prod sales_data                \
   --attr owner=data-team --attr env=production                   \
   --schema '{"type":"struct","fields":[{"id":1,"name":"id","type":"long","required":true}]}'