StarRocks data management

更新时间:
复制 MD 格式

The data catalog provides a unified interface for managing StarRocks metadata. This topic describes how to create and manage data objects like tables and views.

Go to the StarRocks data catalog

  1. Go to the Workspaces page in the DataWorks console. In the top navigation bar, select a desired region. Find the desired workspace and choose Shortcuts > Data Studio in the Actions column.

  2. In the navigation pane on the left, click the image icon. In the Data Directory tree, click StarRocks to open the StarRocks data catalog management page.

Create a StarRocks data catalog

On the StarRocks data catalog management page, you can add existing StarRocks data sources as datasets to the data catalog list.

  1. Click the image icon to the right of the StarRocks data catalog to open the add instance page.

  2. On the DataWorks Data Source tab, add StarRocks data sources to the data catalog list.

    1. To manage an existing StarRocks data source in the current workspace, find the data source on the DataWorks Data Source tab and click Add in the Operation column.

    2. Alternatively, select multiple StarRocks data sources on the DataWorks Data Source tab and click Batch Add at the bottom of the list.

Manage a StarRocks data catalog

You can add and manage data objects such as tables, views, and materialized views in the StarRocks data catalog.

Manage tables

Create a table

  1. Click the image icons to expand the nodes in your StarRocks project down to the database, and then find the Tables node.

  2. Click the image icon to the right of Table to open the Create Table page.

  3. Generate basic table and column information by using one of the following methods:

    • Create table with Copilot:

      1. In the toolbar at the top of the page, click Copilot table creation to open the Copilot Chat interface.

      2. Enter a table creation instruction in natural language (for example, Create a daily user purchase details table).

      3. Click Generate and Replace. The system generates a default table name and column information based on your instruction.

      4. If the table name and columns meet your expectations, click Accept.

        Note

        If you need to modify some table information, click Accept first and then manually edit the system-generated table information.

    • Create table manually:

      Create a table based on the following parameter descriptions.

      Parameter

      Description

      Basic information

      Specify the Table Name, table description, and other information.

      Column information

      Edit columns and column comments.

      • Manual editing: Click the Insert button above the column information list, specify the number of rows to insert, and then edit the column names, column types, and other information.

      • Copilot smart editing: Click Generate Field or Generate field descriptions above the column information list. The system generates relevant columns and descriptions based on the table name and table description you specified.

  4. Configure partition information.

    Partition type

    Parameter description

    Applicable scenario

    No partitioning

    No additional parameters are required.

    Small data volumes.

    Expression partitioning

    Refer to the expression partitioning documentation to configure the Expression Type, Time function, Partition Field, and other parameters.

    Supports expression partitioning (formerly known as automatic partition creation), which is more flexible and easy to use. This type is suitable for most scenarios, such as querying and managing data by continuous date ranges or enumeration values.

    Range partitioning

    Refer to the data distribution documentation to configure the Range type, Partition Field, and other parameters.

    Suitable for simple and continuous data, such as time series data or continuous numerical data.

    List partitioning

    Refer to the List partitioning documentation to configure the Partition Field, Partition Settings, and other parameters.

    Data is partitioned based on explicitly defined enumeration value lists. This type is suitable for querying and managing data by enumeration values.

  5. Configure advanced settings.

    Refer to the Primary Key table, Duplicate Key table, Aggregate table, and Unique Key table documentation to configure the Sort Key and other related parameters.

  6. After the configuration is complete, click Publish in the toolbar at the top to create the table.

Manage tables

  1. View tables.

    After you create a table in a StarRocks instance, click the image icons to expand the nodes in the StarRocks data catalog on the left, and then click Table to view basic table information. You can also click a specific table name to view details such as columns and DDL.

  2. Perform operations on tables.

    Right-click the table you want to operate on, and select Generate Query SQL.

  3. Delete a table.

    Right-click the table you want to delete, and select Delete from the context menu.

    Important

    Deleted tables cannot be recovered. Proceed with caution.

Manage views

Create a view

  1. Click the image icons to expand the nodes in your StarRocks instance down to the database, and then find the Views node.

  2. Click the image icon to the right of View to open the New View page.

  3. Refer to the CREATE VIEW command, change view_name to the name of the view you want to create, and add the data source query statement after the AS keyword.

  4. Click Publish at the top to create the view.

Manage views

  1. View views.

    After you create a view in a StarRocks instance, click the image icons to expand the nodes in the StarRocks instance on the left, and then click View to view basic view information. You can also click a specific view name to view details such as columns and DDL.

  2. Delete a view.

    Right-click the view you want to delete, and select Delete from the context menu.

Manage materialized views

Create a materialized view

  1. Click the image icons to expand the nodes in your StarRocks instance down to the database, and then find MV.

  2. Click the image icon to the right of MV to open the New Materialized View page.

  3. Refer to the CREATE MATERIALIZED VIEW command, change materialized_view_name to the name of the materialized view you want to create, and add the data source query statement after the AS keyword.

  4. Click Publish at the top to create the materialized view.

Manage materialized views

  1. View materialized views.

    After you create a materialized view in a StarRocks instance, click the image icons to expand the nodes in the StarRocks instance on the left, and then click MV to view basic materialized view information. You can also click a specific materialized view name to view details such as columns and DDL.

  2. Delete a materialized view.

    Right-click the materialized view you want to delete, and select Delete from the context menu.

View and remove a StarRocks data catalog

If you no longer need a StarRocks data catalog, you can view and remove the corresponding StarRocks data catalog.

  1. View data catalogs.

    1. After you add an instance to the StarRocks data catalog, click the image icon on the left of the StarRocks data catalog to view the added StarRocks instances.

    2. Hover over the corresponding StarRocks instance to view the associated data source name.

  2. Remove a data catalog.

    If you no longer need to manage a StarRocks data catalog, right-click the corresponding StarRocks data catalog and select Remove from the context menu to remove the data catalog.

FAQ

Q: Metadata fails to load, and the error "you need (at least one of) the SELECT privilege(s) on TABLE tables for this operation" is returned.

A: You need to grant the SELECT privilege on the information_schema database. For more information, see Grant privileges to users in EMR Serverless StarRocks.