mc table view create

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

Views are virtual tables defined by SQL queries. You can provide multiple SQL representations with different dialects for cross-engine compatibility.

Parameters

ALIAS

Required

The alias of an AIStor cluster on which to create the view.

NAMESPACE

Required

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

VIEW_NAME

Required

The name of the view to create.

WAREHOUSE

Required

The name of the warehouse containing the target namespace.

--sql

Required

The SQL query that defines the view. Can be specified multiple times with a dialect prefix for different query engines.

Use the format dialect:SQL to specify a dialect-specific SQL representation:

  • spark:SELECT ... for Spark SQL syntax
  • trino:SELECT ... for Trino SQL syntax

Without a dialect prefix, the SQL is treated as a generic representation.

--attr

Alias: -a

Optional

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

--ignore-existing

Alias: -p

Optional

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

Global flags

This command supports any of the global flags.

Examples

Create a simple view

Use mc table view create to create a view with a SQL query:

mc table view create myaistor analytics prod monthly_sales --sql "SELECT * FROM sales WHERE month = 1"

Create a view with a specific dialect

Use the dialect prefix to specify the SQL syntax:

mc table view create myaistor analytics prod monthly_sales --sql "spark:SELECT * FROM sales"

Create a view with multiple dialect-specific SQL representations

Specify multiple SQL representations for different query engines:

mc table view create myaistor analytics prod monthly_sales --sql "spark:SELECT * FROM sales" --sql "trino:SELECT * FROM sales"

Create a view with custom properties

Use the --attr flag to add custom properties:

mc table view create myaistor analytics prod monthly_sales --sql "SELECT * FROM sales" --attr owner=data-team --attr env=production