Creating Dimensions
A dimension is a perspective to observe and analyze business data. It supports data aggregation, drilling, and slicing analysis and is used as the GROUP BY condition in SQL statements. Most dimensions have hierarchical structures, such as geographic dimensions (including countries, regions, provinces, and cities) and time dimensions (including annually, quarterly, and monthly dimensions). Creating a dimension is a way to standardize the existence and uniqueness of business entities (also called primary data) from the top down.
Creating and Publishing a Dimension
- Log in to the DGC console, select a DGC instance, and click Access.
On the displayed page, click the Workspaces tab. In the workspace list, locate the required workspace.
- Click Data Design of the corresponding workspace to access the Data Design console.
- Choose Dimensional Modeling from the left navigation bar and click the Dimensions tab.
- Select an object from the subject tree on the left and click Create to create a dimension.
Before creating a dimension, if you have not added any subject information, add it. See Designing Subjects.
- On the displayed page, set parameters as prompted.
Set the basic configurations and physicalization configurations shown in the following figure:
Figure 1 Creating a dimension
Table 1 Parameters of Basic Configuration Parameter
Description
Subject
Click Select. In the dialog box that is displayed, select the subject you need, and click OK.
Name
Only letters, digits, and underscores (_) are allowed. Dimension names must start with letters.
Code
The code of the dimension to be created. The system automatically synchronizes the dimension name to the Code text box. Only letters, digits, and underscores (_) are allowed. Dimension codes must start with letters.
Dimension Type
- Basic: A dimension that does not have a hierarchical structure.
- Lookup Table: A dimension created based on a lookup table. The field information and data of the dimension are the same as those of the lookup table, indicating that the content is an enumerable dimension.
- Hierarchy: dimension with a hierarchical structure between attributes.
Asset Owner
Select the asset owner that the dimension belongs to from the drop-down list. Only the workspace administrator or developer can be set as the owner.
Description
A description of the dimension to be created. Up to 600 characters are supported.
Table 2 Parameters of Physicalization Configuration Parameter
Description
Data Connection Type
Select a data connection type from the drop-down list.
Data Connection
The name of the data connection. Select the required data connection. You are advised to use the same data connection for an ER model.
If you have not created a data connection yet, access to the DGC Management Center to create one. For details, see Creating Data Connections.
Database
The name of the database. Select a database from the drop-down list. If you have not created a database yet, access to the DGC Data Development console to create one. For details, see Creating a Database.
Queue
DLI queue. This parameter is displayed only for DLI data connections.
Schema
This parameter is displayed for DWS data connections.
Table Type
This parameter is displayed only for DWS data connections. The options are:
- DWS_ROW indicates that tables are stored to disk partitions by row.
- DWS_COLUMN indicates that tables are stored to disk partitions by column.
DISTRIBUTE BY
This parameter is displayed only for DWS data connections.
- REPLICATION: A full table is stored on each DN. The advantage of this option is that each DN has all the data of a table. During the join operation, data redistribution can be avoided, reducing network overhead. The disadvantage is that each DN retains the complete data of a table, resulting in data redundancy. Generally, this option is recommended for small dimension tables.
- HASH: If you select this option, you need to specify a distribution key for the user table. When a record is inserted, the system performs hash computing based on values in the distribute keys and then stores data on the corresponding DN. In a Hash table, I/O resources on each node can be used during data read/write, which improves the read/write speed of a table. Generally, this option is recommended for large dimension tables (a large dimension table contains over 1 million records).
Add dimension attributes in the Attribute Configuration area. You can click Add to add multiple dimension attributes.
Table 3 Parameters of Attribute Configuration Parameter
Description
Name
Only letters, digits, and underscores (_) are allowed. Attribute names must start with letters.
Code
Only letters, digits, and underscores (_) are allowed. Attribute codes must start with letters.
Data Standard
Click
to select a data standard to be associated with the field. Choose Configuration Center > Function Configuration and select Create Quality Jobs. Associate fields with a data standard. After a dimension table is published, a quality job is automatically generated. A quality rule is generated for each field associated with the data standard. The quality of the field is monitored based on the data standard. You can go to the Quality Job page of the DGC Data Quality Control to view the job details.If you click Associate with Data Standard above the field list and select a data standard that you want to associate the field with, a new table field associated with the selected data standard is automatically created. The default field name and code are the same as those of the associated data standard. You can change the field name and code if necessary.
If you have not created a data standard, create one. See Data Standards for details.
Data Type
Type of data defined based on the original data.
Primary Key
Select a proper field as the primary key based on service requirements. By default, the first dimension attribute is the primary key.
Surrogate Key
Select a proper field as the surrogate key based on service requirements.
Partition
Whether to be set as a partition field.
Not Null
Whether the parameter value can be left empty.
Description
A description of the dimension attribute you add.
On the Mapping Settings tab page, click Create to create the mapping between dimensions and fact tables. Set the parameters shown the figure below.
Figure 2 Mapping settings
Table 4 Parameters of mappings Parameter
Description
Mapping
Only letters, digits, and underscores (_) are allowed.
Model
Select a created relationship model from the drop-down list box. If no relationship model has been created, create one. See Designing Physical Models.
Table
Select a table from which data is obtained. If data is obtained from multiple tables, click
next to the table name to set the JOIN condition between the table and another table.- Select a JOIN mode. The JOIN mode includes left JOIN, right JOIN, inner JOIN, and outer JOIN from left to right.
- Set the JOIN condition in the JOIN field. Generally, select the fields with the same meaning in the source table and joined table. Click
or
to add or delete a JOIN condition. The relationship between JOIN conditions is AND. - Click OK.
- If you want to delete a joined table after setting the JOIN condition, click
next to the table name.
Figure 3 Join Condition dialog box
Field Mapping
Select a source field with the same meaning as the current mapping field. If a table field comes from multiple models, you need to create multiple mappings. In each mapping, you only need to set the source field for the field that comes from the current mapping. Other fields do not need to be set.
In the upper right corner of the Mappings area, click
to delete a specified mapping or click
to collapse the mapping area. - Click Save and Publish.
- In the displayed dialog box, select a reviewer and click Confirm.
- Repeat steps 4 to 7 to create and publish other dimensions.
- All dimensions need to be approved by reviewers.
After a dimension publishing application is approved, the system automatically creates a dimension table corresponding to the dimension. The name and code of the dimension table are the same as those of the dimension. On the Dimensional Modeling page, click the Dimension Tables tab to view the created dimension table.
In the dimension table list, you can view the synchronization status of the dimension table in the Sync Status column.
- If the synchronization is successful, the dimension is successfully published and the dimension table is successfully created in the database.
- If the synchronization failed, click View Publish History in the row where the dimension table is located. On the displayed page, click the Publish Log tab to view logs. Troubleshoot the problem based on the logs. After the error is rectified, go back to the dimension table list and click Synchronize above the dimension table list to issue the synchronization command again. If the problem persists, contact technical support personnel.
Figure 4 Synchronization status
Editing a Dimension
- On the Data Design console, choose Dimensional Modeling from the left navigation bar. On the displayed page, click the Dimensions tab.
- In the dimension list, select the dimension you want to edit and click Edit in the Operation column. The Edit Dimension page is displayed.
- Edit the dimension information as required.
- Click Save to save the settings. Alternatively, click Save and Publish to publish the edited dimension.
Publishing a Dimension
If a dimension is created but not published, perform the following steps to publish the dimension:
- On the Data Design console, choose Dimensional Modeling from the left navigation bar. On the displayed page, click the Dimensions tab.
- In the dimension list, find the dimension you want to publish and click Publish in the Operation column.
- In the displayed dialog box, select a reviewer and click Confirm.
Suspending a Dimension
To bring a published dimension offline, perform the following steps:
- On the Data Design console, choose Dimensional Modeling from the left navigation bar. On the displayed page, click the Dimensions tab.
- In the dimension list, find the dimension you want to suspend and click Suspend in the Operation column.
- In the displayed dialog box, select a reviewer and click Confirm.
Deleting a Dimension
If a dimension is no longer needed, you can delete it. However, if the dimension has been published, you must bring the dimension offline before deleting it. For details, see Suspending a Dimension.
- On the Data Design console, choose Dimensional Modeling from the left navigation bar. On the displayed page, click the Dimensions tab.
- Select the dimension you want to delete from the dimension list and click Delete in the upper left.
- In the Delete Dimension dialog box, confirm whether the information is correct. If there is no need of modification, click OK.
After you select Delete physical tables in the dialog box, the physical tables in the database are also deleted when you delete the table.
Last Article: Dimensional Modeling
Next Article: Managing Dimension Tables
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.