All Products
Search
Document Center

Hologres:Create a foreign table

Last Updated:Dec 25, 2023

This topic describes how to use HoloWeb to create, edit, and delete a foreign table that is sourced from MaxCompute. This topic also describes how to preview the source data and the DDL statement of the foreign table.

Prerequisites

You have logged on to a Hologres instance. For more information, see Log on to an instance.

Create a foreign table

  1. Log on to the Hologres console.

  2. In the top navigation bar, select a region from the drop-down list.

  3. In the left-side navigation pane of the Hologres console, click Go to HoloWeb to go to the HoloWeb console. Go to HoloWeb

  4. In the main menu bar of the HoloWeb console, choose Metadata Management > MaxCompute Acceleration > Create Foreign Table.

    You can also click Instances Connected in the left-side navigation pane of the Metadata Management tab. Click the instance that you want to manage and click the database that you want to manage. Right-click the schema that you want to manage and select New foreign table.

  5. On the New foreign table tab, configure the parameters.

    Section

    Parameter

    Description

    Source MaxCompute Table

    Project Name

    The name of the MaxCompute project.

    Schema Name

    The name of the schema in which the MaxCompute table resides. If your MaxCompute project uses the two-layer model, this parameter is not displayed by default. If your MaxCompute project uses the three-layer model, you can select an authorized schema from the drop-down list.

    Table Name

    The name of the MaxCompute table. Prefix-based fuzzy search is supported.

    Destination Hologres Table

    Database Name

    The name of the Hologres database to which the foreign table belongs.

    Schema Name

    Schema Name

    You can select the default schema named public or a custom schema.

    Table Name

    The name of the Hologres foreign table.

    The name of the source MaxCompute table is automatically specified for this parameter. You can also manually rename the table.

    Destination Table Description

    The description of the Hologres foreign table that you create, which is user-defined.

    Note

    When you create a foreign table to synchronize data from a MaxCompute table, comments of both field names and columns of the MaxCompute table are synchronized to the foreign table.

  6. Click Submit. After the foreign table is submitted, you can refresh the left-side instance lists. The created foreign table is displayed in the schema that you selected.

  7. Optional: On the configuration tab of the foreign table, click Query table to go to the SQL query window and execute standard PostgreSQL statements to analyze data.

Edit a foreign table

  1. In the left-side navigation pane, click Instances Connected. All the connected instances are displayed.

  2. Click the instance that you want to manage. All the created databases are displayed.

  3. Click the database that you want to manage, click the schema that you want to manage, and then click Foreign Tables. All the created foreign tables are displayed.

  4. Right-click the foreign table that you want to manage and select Edit Table.

  5. Modify the fields and partitions of the foreign table that is mapped from the source MaxCompute table based on your business requirements.编辑外部表

  6. Click Submit. The foreign table is edited.

Rename a foreign table

  1. In the left-side navigation pane, click Instances Connected. Find the foreign table that you want to manage.

    For more information about how to query a foreign table, see Step 1 to Step 3 in Edit a foreign table.

  2. Right-click the foreign table that you want to rename and select Rename.

  3. Click OK.

Delete a foreign table

  1. In the left-side navigation pane, click Instances Connected. Find the foreign table that you want to manage.

    For more information about how to query a foreign table, see Step 1 to Step 3 in Edit a foreign table.

  2. Right-click the foreign table that you want to delete and select Delete Table.

  3. Click OK.

Preview data

  1. In the left-side navigation pane, click Instances Connected. Find the foreign table that you want to manage.

    For more information about how to query a foreign table, see Step 1 to Step 3 in Edit a foreign table.

  2. Double-click the foreign table that you want to preview. On the configuration tab of the foreign table, click Data preview.