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
Go to the Workspaces page in the DataWorks console. In the top navigation bar, select a desired region. Find the desired workspace and choose in the Actions column.
In the navigation pane on the left, click the
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.
Click the
icon to the right of the StarRocks data catalog to open the add instance page.
On the DataWorks Data Source tab, add StarRocks data sources to the data catalog list.
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.
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
Click the
icons to expand the nodes in your StarRocks project down to the database, and then find the Tables node.
Click the
icon to the right of Table to open the Create Table page.
Generate basic table and column information by using one of the following methods:
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. |
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.
After the configuration is complete, click Publish in the toolbar at the top to create the table.
Manage tables
View tables.
After you create a table in a StarRocks instance, click the
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.
Perform operations on tables.
Right-click the table you want to operate on, and select Generate Query SQL.
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
Click the
icons to expand the nodes in your StarRocks instance down to the database, and then find the Views node.
Click the
icon to the right of View to open the New View page.
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.
Click Publish at the top to create the view.
Manage views
View views.
After you create a view in a StarRocks instance, click the
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.
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
Click the
icons to expand the nodes in your StarRocks instance down to the database, and then find MV.
Click the
icon to the right of MV to open the New Materialized View page.
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.
Click Publish at the top to create the materialized view.
Manage materialized views
View materialized views.
After you create a materialized view in a StarRocks instance, click the
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.
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.
View data catalogs.
After you add an instance to the StarRocks data catalog, click the
icon on the left of the StarRocks data catalog to view the added StarRocks instances.
Hover over the corresponding StarRocks instance to view the associated data source name.
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.