Background
Traditionally, the display and management of databases and tables are flat. All databases are directly listed. When you view a single database, all tables are listed. If a large number of databases are available or a single database has a large number of tables, it is difficult to view and manage them, as shown in the following figure.
In the preceding example, the database has 586 tables. You cannot directly view all the tables in the list. To solve this problem, you can use hierarchical management and classification management.
Hierarchical management
You can implement hierarchical management by adding tags in the statements for creating databases and tables.
#Create a database.
create schema x1 with dbproperties(
tags='China. Zhejiang province, industry' --- Add tags
)
#Create a table
create table yy(
id int
)with tblproperties(
tags='Internet.IoT, Internet. Finance' --- Add tags
)
“Tags” is a string that allows multiple tag words, which are separated with English symbols (commas, spaces, or semicolons). The tag word hierarchy is indicated by decimal point, for example
'Internet.IoT'
and'Internet. Finance'
. Both these tags have two layers, with the same prefix ‘Internet’.You can use tags to classify and manage database and table lists.