Updated on 2022-09-23 GMT+08:00

Importing/Exporting Tables

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

Importing a Table to a Logical Model

  1. On the DataArts Architecture page, choose Models > ER Modeling in the left navigation pane.
  2. On the model overview page, click the card of the target logical model, select an object in the subject directory, and choose More > Import.
  3. In the dialog box displayed, click ER Modeling Template.

    Figure 1 Import Table dialog box
    Table 1 Parameters for importing a table

    Parameter

    Description

    Update Table

    Whether to update the existing table if the table to be imported already exists in the ER model. The system determines whether the table to import exists in the ER model based on the table code. The import operation can be used to create a table or update an existing table. It does not delete a table. 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 must publish the table again after updating it so that the updated table can take effect.

    Upload File

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

    • Downloading the ER modeling template and fill in the template

      In the Import Table dialog box, click ER Modeling Template to download the template, fill in the template, and save the settings.

    • Exporting tables to files

      You can export the lookup tables created in DataArts Architecture of a DataArts Studio instance to an Excel file. Then, import the Excel file. See Exporting a Table or DDL for details.

  4. Open the downloaded template, set the parameters in the template, and save the template. The Description sheet in the template is for reference only.

    Parameters whose names start with an asterisk (*) are mandatory, and other parameters are optional.

    The table below describes the parameters in the Tables sheet.

    Table 2 Parameters in the Tables sheet

    Parameter

    Description

    Subject

    Enter the encoding paths of existing subjects, which are separated by slashes (/). If no subject is available, create one by referring to Designing Subjects.

    *Logical Entity Name

    It must start with letters. Only letters, digits, and the following special characters are allowed: ()-_

    *Table Name

    Name of the table. Table codes cannot start with numbers. Only letters, numbers, and the following special characters are allowed: _${}

    Table Alias

    Alias of a table. This parameter is displayed when you have enabled Table Alias on the Configuration Center page.

    Table Tags

    Tags to be added to the table. Enter an existing or a new tag. You can add a tag on the Tags page of DataArts Catalog and go back to this page to select the tag. For details on how to add a tag, see Tags.

    *Table Description

    A description of the table.

    Owner

    You can enter an owner name or select an existing owner in the current workspace of the DataArts Studio instance.

    Parent Table

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

    DWS DISTRIBUTE BY

    This field is required only for DWS data connections. The HASH (attribute name) and REPLICATION modes are supported.

    *Field Name

    The name of a field in the table. It must start with letters. Only letters, digits, and the following special characters are allowed: ()-_

    Field Code

    The code of the field in the table. It must start with letters. Only letters, digits, and underscores (_) are allowed.

    Field Alias

    Alias of a field. This parameter is displayed when you have enabled Field Alias on the Configuration Center page.

    Field Ordinal

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

    Field Description

    A description of the field.

    *Field Data Type

    Data type of the logical model. For details, see the DEFAULT group in Data Types.

    Field Data Length

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

    For example, for the DWS data connection type, if the field type is CHAR(10), set Field Data Type to CHAR and Field 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.

    Associate Data Standard

    The code of the data standard to be associated. This field can be left blank. If no data standard is available, create one. See Creating Data Standards for details.

    Field Tags

    Tags to add to the field. Enter an existing tag or a new tag.. You can add a tag on the Tags page of DataArts Catalog and go back to this page to select the tag. For details on how to add a tag, see Tags.

    Table 4 describes the parameters in the Relations sheet.

    Currently, mappings cannot be imported. You do not need to fill in the Mappings sheet.

  5. View the 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.

    Figure 2 Last Import tab page

Importing a Table to a Physical Model

  1. On the DataArts Architecture page, choose Models > ER Modeling in the left navigation pane.
  2. In the ER model tree, select a physical model, expand it, and select a target. Then, choose More > Import.
  3. In the dialog box displayed, click ER Modeling Template.

    Figure 3 Import Table dialog box
    Table 3 Parameters for importing a table

    Parameter

    Description

    Update Table

    Whether to update the existing table if the table to be imported already exists in the ER model. The system determines whether the table to import exists in the ER model based on the table code. The import operation can be used to create a table or update an existing table. It does not delete a table. 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 must publish the table again after updating it so that the updated table can take effect.

    Upload File

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

    • Downloading the ER modeling template and fill in the template

      In the Import Table dialog box, click ER Modeling Template to download the template, fill in the template, and save the settings.

    • Exporting tables to files

      You can export the lookup tables created in DataArts Architecture of a DataArts Studio instance to an Excel file. Then, import the Excel file. See Exporting a Table or DDL for details.

  4. Open the downloaded template, set the parameters in the template, and save the template. The Description sheet in the template is for reference only.

    Parameters whose names start with an asterisk (*) are mandatory, and other parameters are optional.

    The table below describes the parameters in the Tables sheet.

    Table 4 Parameters in the Tables sheet

    Parameter

    Description (Importing DLI/POSTGRESQL/DWS/MRS Hive Tables)

    Subject

    Enter the encoding paths of existing subjects, which are separated by slashes (/). If no subject is available, create one. For details, see Designing Subjects.

    *Logical Entity Name

    It must start with letters. Only letters, digits, and the following special characters are allowed: ()-_

    *Table Name

    Name of the table. Table codes cannot start with numbers. Only letters, numbers, and the following special characters are allowed: _${}

    Table Alias

    Alias of a table. This parameter is displayed when you have enabled Table Alias on the Configuration Center page.

    Table Tags

    Tags to be added to the table. Enter an existing or a new tag. You can add a tag on the Tags page of DataArts Catalog and go back to this page to select the tag. For details on how to add a tag, see Tags.

    *Table Description

    A description of the table.

    Asset Owner

    Enter the username for entering the current workspace. Only the workspace admin, developer, or O&M personnel can be set as the designer.

    Data Connection Type

    The following connection types are supported: DWS, DLI, POSTGRESQL, and MRS Hive.

    *Table Type

    DLI models support the following table types:
    • DLI_MANAGED: Data is stored in a DLI table.
    • DLI_EXTERNAL: Data is stored in an OBS table. When Table Type is set to DLI_EXTERNAL, you must 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 Data Connection Type is DLI, enter a DLI queue name. If Data Connection Type is DWS or POSTGRESQL, enter a schema name.

    *Field Name

    The name of a field in the table. It must start with letters. Only letters, digits, and the following special characters are allowed: ()-_

    *Field Code

    The code of the field in the table. It must start with letters. Only letters, digits, and underscores (_) are allowed.

    Field Ordinal

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

    Field Description

    A description of the field.

    *Field Data Type

    The supported data types vary depending on the data connection types. For details, see Data Types.

    Field Data Length

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

    For example, for the DWS data connection type, if the field type is CHAR(10), set Field Data Type to CHAR and Field 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.

    Associate Data Standard

    The code of the data standard to be associated. This field can be left blank. If no data standard is available, create one. For details, see Creating Data Standards.

    Field Tags

    Tags to add to the field. Enter an existing tag or a new tag.. You can add a tag on the Tags page of DataArts Catalog and go back to this page to select the tag. For details on how to add a tag, see Tags.

    configs

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

    {

    "option_name1": "value",

    "option_name2": "value"

    ......

    }

    Example:

    {

    "a1": "100",

    "a2": "30"

    }

    Version

    This parameter is optional.

    Table 4 describes the parameters in the Relations sheet.

    Currently, mappings cannot be imported. You do not need to fill in the Mappings sheet.

  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 or DDL

  1. On the DataArts Architecture page, choose Models > ER Modeling in the left navigation pane.
  2. On the model overview page, click the card of the target logical model, select an object in the subject directory, and choose More > Export.

    Figure 4 Exporting a table or DDL

  3. In the dialog box displayed, select the objects to export.

    The exported Excel file can be imported.
    Figure 5 Exporting a table

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

    Figure 6 Exporting a DDL

  4. Click OK.