Importing/Exporting Tables

You can import tables to an ER model in batches. You can also export existing ER models and import the exported model files to other ER models.

The following parts are included in this section:

Importing a Table to a Logical Model

  1. On the DGC Data Design console, choose ER Modeling from the left navigation bar.
  2. In the ER model tree, select a logical model, expand it, and select a target. Then, choose More > Import.
  3. In the displayed dialog box, click ER Modeling Template.

    Table 1 Parameters for importing tables

    Parameter

    Description

    Update Existing Table

    Whether to update the existing table information. The system determines whether the table to be imported exists in the ER model based on the table code. During the import, only table creation and update are allowed. The options are as follows:

    • No: If you select this option, the existing tables will not be updated.
    • Yes: If you select this option, the existing tables will be updated. If a table is in the Published state, you need to publish the table again after updating it so that the updated table can take effect.

    Upload File

    Select the file to be imported. You can use either of the following methods to obtain the file to be imported:

    • Downloading the ER modeling template and fill in the template

      In the Import Table dialog box, click ER Modeling Template to download the template, set parameters in the template as required, and save the settings.

    • Exporting tables to files

      You can export the tables created in Data Design of a DGC instance to Excel files in advance. Then, import the Excel files. See Exporting a Table/DDL for details.

  4. Open the downloaded template, set parameters in the template based on actual requirements, and save the template. The "Description" sheet in the template is for reference only.

    Parameters whose names start with * are mandatory, and those that do not start with * are optional.

    The table below describes the parameters in the Table Model sheet.

    Table 2 Parameters in the "Table Model" sheet

    Parameter

    Parameter

    Subject Area

    Enter the encoding paths of existing subjects, which are separated by slashes (/). If you have not created a subject, create one by referring to Designing Subjects.

    *Logical Entity

    The name of the table. Only letters, digits, and underscores (_) are allowed. Table names cannot start with digits.

    *Table Name

    The code of the table. Only letters, digits, underscores (_), $, {, and } are allowed. Table codes cannot start with digits.

    Alias

    Alias of a table. This parameter is displayed when a user selects the table alias option in the configuration center. The value can include only letters, numbers, underscores (_), dollar signs ($), left braces ({), and right braces (}) and cannot start with a number.

    Attribute Alias

    Alias of an attribute. This parameter is displayed when a user selects the attribute alias option in the configuration center. The value can include only letters, numbers, underscores (_), dollar signs ($), left braces ({), and right braces (}) and cannot start with a number.

    Table Tag

    Tag to be added to a table. Enter an existing tag or a new tag.. You can add a tag on the Tag page of DGC Data Assets module and then go back to add this tag. For details on how to add a tag, see Tags.

    Description

    A description of the table.

    Asset Owner

    Enter the username for entering the current workspace. Only the workspace administrator or developer can be set as the owner.

    Parent Table

    You can enter only the names of other tables in this template.

    *Attribute Name

    The name of the attribute field in a table. Only letters, digits, brackets, spaces, hyphens (-) and underscores (_) are allowed. Table names must start with letters.

    Attribute Code

    The name of the OBS folder. Only letters, digits, brackets, spaces, hyphens (-) and underscores (_) are allowed. Attribute names must start with letters.

    No.

    Sequence number of an attribute field in a table. The value starts from 1. This parameter is optional. If this parameter is left blank, attribute fields are sorted in the sequence in the template by default.

    Description

    A description of an attribute field.

    *Data Type

    Data type of the logical model. For details, see the DEFAULT group in Managing a Field Type.

    Data Length

    Data length. For a variable-length data type, specify the data length if the specified data connection type supports the specified data length.

    For example, for the DWS connection type, if the field type is CHAR(10), set Data Type to CHAR and Data Length to 10.

    Partition

    The value Y indicates that the field is a partition field, and the value N indicates that the field is not a partition field.

    Primary Key

    The value Y indicates that the field is a primary key, and the value N indicates that the field is not a primary key.

    Not Null

    The value Y indicates that the field is not empty, and the value N indicates that the field can be empty.

    Referenced Data Standard Code

    The code of the data standard to be referenced. This field can be left blank. If you have not created a data standard, create one. See Data Standards for details.

    Attribute Tag

    Tag to be added to an attribute field. Enter an existing tag or a new tag.. You can add a tag on the Tag page of DGC Data Assets module and then go back to add this tag. For details on how to add a tag, see Tags.

    Table 4 describes the parameters in the Relationships sheet.

    The table below describes the parameters in the Mappings sheet.

    Table 3 Parameters in the "Mappings" sheet

    Parameter

    Parameter

    Mapping

    Only letters, digits, and underscores (_) are allowed.

    Mapping Description

    A description of the mapping.

    *Table

    Enter the name of an existing table.

    *Table Field

    The code of the mapping field.

    Source Table Name

    The name of the table from which data is obtained. You need to enter the name of an existing table.

    Source Table Field Code

    Enter the code of the source table field.

    Field Mapping Description

    A description of the field.

  5. View the result in the Last Import tab page. If the import is successful, click Close. If the import fails, you can view the failure cause, correct the template file, and upload it again.

Importing a Table to a Physical Model

  1. On the DGC Data Design console, choose ER Modeling from the left navigation bar.
  2. In the ER model tree, select a physical model, expand it, and select a target. Then, choose More > Import.
  3. In the displayed dialog box, click ER Modeling Template.

    Table 4 Parameters for importing tables

    Parameter

    Description

    Update Existing Table

    Whether to update the existing table information. The system determines whether the table to be imported exists in the ER model based on the table code. During the import, only table creation and update are allowed. The options are as follows:

    • No: If you select this option, the existing tables will not be updated.
    • Yes: If you select this option, the existing tables will be updated. If a table is in the Published state, you need to publish the table again after updating it so that the updated table can take effect.

    Upload File

    Select the file to be imported. You can use either of the following methods to obtain the file to be imported:

    • Downloading the ER modeling template and fill in the template

      In the Import Table dialog box, click ER Modeling Template to download the template, set parameters in the template as required, and save the settings.

    • Exporting tables to files

      You can export the tables created in Data Design of a DGC instance to Excel files in advance. Then, import the Excel files. See Exporting a Table/DDL for details.

  4. Open the downloaded template, set parameters in the template based on actual requirements, and save the template. The "Description" sheet in the template is for reference only.

    Parameters whose names start with * are mandatory, and those that do not start with * are optional.

    The table below describes the parameters in the Table Model sheet.

    Table 5 Parameters in the "Table Model" sheet

    Parameter

    Description (Importing DLI/DWS/MRS_HIVE Tables)

    Subject Area

    Enter the encoding paths of existing subjects, which are separated by slashes (/). If you have not created a subject, create one by referring to Designing Subjects.

    *Logical Entity

    The name of the table. Only letters, digits, and underscores (_) are allowed. Table names cannot start with digits.

    *Table Name

    The code of the table. Only letters, digits, underscores (_), $, {, and } are allowed. Table codes cannot start with digits.

    Table Tag

    Tag to be added to a table. Enter an existing tag or a new tag.. You can add a tag on the Tag page of DGC Data Assets module and then go back to add this tag. For details on how to add a tag, see Tags.

    Description

    A description of the table.

    Asset Owner

    Enter the username for entering the current workspace. Only the workspace administrator or developer can be set as the owner.

    Data Connection Type

    The following connection types are supported: DLI, DWS and MRS_HIVE.

    *Table Type

    DLI models support the following table types:

    • Managed indicates that data is stored in a DLI table.
    • External indicates that data is stored in an OBS table. When Table Type is set to External, you need to set OBS Path.
    • DLI_VIEW is available for import only.

    DWS models support the following table types:

    • DWS_ROW: row type
    • DWS_COLUMN: column type
    • DWS_VIEW: view type

      This parameter is unavailable for the tables created in MRS_HIVE models.

    OBS Path

    Enter an OBS path for storing the source data associated with the table If Table Type is set to DLI_EXTERNAL. The OBS path format is bucket_name/filepath.

    Data Format

    This parameter is available only for tables created in DLI models.

    If the table type is "DLI_MANAGED", the options of the data format are Parquet and Carbon.

    If the table type is "DLI_EXTERNAL", the options of the data format are Parquet, Carbon, CSV, ORC, JSON, and Avro.

    Data Connection

    Enter the name of a created data connection.

    Database

    Enter the name of a created database.

    Connection Extra

    If the connection type is DLI, enter a DLI queue name. If the connection type is DWS, enter a DWS schema name.

    *Attribute Name

    The name of the attribute field in a table. Only letters, digits, brackets, spaces, hyphens (-) and underscores (_) are allowed. Table names must start with letters.

    Attribute Code

    The name of the OBS folder. Only letters, digits, brackets, spaces, hyphens (-) and underscores (_) are allowed. Attribute names must start with letters.

    No.

    Sequence number of an attribute field in a table. The value starts from 1. This parameter is optional. If this parameter is left blank, attribute fields are sorted in the sequence in the template by default.

    Description

    A description of an attribute field.

    *Data Type

    The supported data types vary depending on the data connection types. For details, see Managing a Field Type.

    Data Length

    For a variable-length data type, specify the data length if the specified data connection type supports the specified data length.

    For example, for the DWS connection type, if the field type is CHAR(10), set Data Type to CHAR and Data Length to 10.

    Partition

    The value Y indicates that the field is a partition field, and the value N indicates that the field is not a partition field.

    Primary Key

    The value Y indicates that the field is a primary key, and the value N indicates that the field is not a primary key.

    Not Null

    The value Y indicates that the field is not empty, and the value N indicates that the field can be empty.

    Referenced Data Standard Code

    The code of the data standard to be referenced. This field can be left blank. If you have not created a data standard, create one. See Data Standards for details.

    Attribute Tag

    Tag to be added to an attribute field. Enter an existing tag or a new tag.. You can add a tag on the Tag page of DGC Data Assets module and then go back to add this tag. For details on how to add a tag, see Tags.

    Other Configurations

    Additional table configuration details stored in JSON format. The format is as follows:

    {

    "option_name1": "value",

    "option_name2": "value"

    ......

    }

    Examples:

    {

    "a1": "100",

    "a2": "30"

    }

    Version

    This parameter is optional.

    Table 4 describes the parameters in the Relationships sheet.

    The table below describes the parameters in the Mappings sheet.

    Table 6 Parameters in the "Mappings" sheet

    Parameter

    Parameter

    Mapping

    Only letters, digits, and underscores (_) are allowed.

    Mapping Description

    A description of the mapping.

    *Table

    Enter the name of an existing table.

    *Table Database

    Enter the name of the database that the mapping table belongs to.

    *Table Field

    The code of the mapping field.

    Source Table Name

    The table from which data is obtained. You need to enter the name of an existing table. All source tables in a mapping must come from the same model.

    Source Table Database

    Enter the database that the source table belongs to.

    Source Table Model

    Enter the name of the ER model that the source table belongs to. If this parameter is not set, the current model is used by default.

    Source Table Field Code

    Enter the code of the source table field.

    Field Mapping Description

    A description of the field.

  5. View the import result on the Last Import tab page. If the import is successful, click Close. If the import fails, you can view the failure cause, correct the template file, and upload it again.

Exporting a Table/DDL

  1. On the DGC Data Design console, choose ER Modeling from the left navigation bar.
  2. In the ER model tree, select a model, right-click the model, and choose More > Export from the short-cut menu.
  3. In the displayed dialog box, select the objects to be exported.

    The exported Excel file can also be imported.

    When a DDL is exported, the DDL statements of the selected table are exported to TXT files.

    Figure 1 Exporting a DDL

  4. Click OK.