Use DataStudio to import MaxCompute data into Hologres through the one-click MaxCompute data synchronization feature. This GUI-driven approach delivers better query performance than querying a MaxCompute foreign table directly.
Prerequisites
Before you begin, ensure that you have:
A Hologres data source created in DataWorks and attached to the DataStudio module (see Attach a Hologres instance)
Background
DataStudio's one-click MaxCompute data synchronization feature imports MaxCompute table data into a Hologres internal table through a visual interface. Once the data is in Hologres, queries run against the internal table instead of the MaxCompute foreign table, which significantly improves performance.
To import data using SQL instead of the GUI, see Replicate MaxCompute data to internal table.
Import MaxCompute data
Step 1: Create a one-click MaxCompute data synchronization node
Log on to the DataWorks console. In the top navigation bar, select your region. In the left-side navigation pane, choose Data Development and O&M > Data Development. Select your workspace from the drop-down list and click Go to Data Development.
In the left navigation pane of the DataStudio interface, click
to go to the Data Development page.In the top menu bar, click Create, then choose Create Node > Hologres > One-click MaxCompute Data Synchronization.
In the Create Node dialog box, select an Engine Instance and a Path, enter a Name, and click OK.
Step 2: Configure the node
On the node configuration page, configure the parameters for each section.
MaxCompute source table
The Foreign Table Source field determines which parameters are required. Choose the path that matches your situation.
If you already have a foreign table in Hologres that maps to your MaxCompute data:
Select Existing foreign table, then configure the following parameters:
| Parameter | Description |
|---|---|
| Destination Connection | The name of the attached Hologres data source. |
| Destination Database | The name of the database in the Hologres instance. |
| External Schema | The schema in Hologres where the existing MaxCompute foreign table is located. |
| Foreign Table Name | The name of the existing MaxCompute foreign table in Hologres. |
If no foreign table exists yet (a new one will be created during synchronization):
Select Creating a foreign table, then configure the following parameters:
| Parameter | Description |
|---|---|
| Destination Connection | The name of the attached Hologres data source. |
| Destination Database | The name of the database in the Hologres instance. |
| External server | The server used to connect to MaxCompute. After a Hologres instance is created, a server named odps_server is automatically available. For background, see postgres_fdw. |
| MaxCompute Project | The name of the MaxCompute project. |
| MaxCompute Table Name | The name of the MaxCompute table from which to synchronize data. |
Destination table settings
| Parameter | Description |
|---|---|
| Target Schema | The schema in the current Hologres database. |
| Destination Table Name | The name of the Hologres internal table to import data into. |
| Destination Table Description | A custom description for the internal table. |
If a Hologres internal table with the same name already exists, running the sync task drops the existing table and all its data, then recreates it. Back up any data you need to keep before running the task.
Import GUC parameter settings
| Parameter | Description |
|---|---|
| GUC Parameters | Grand Unified Configuration (GUC) parameters to apply before importing. For supported parameters, see GUC parameters. Other SQL statements are not supported here. |
Synchronization settings
| Parameter | Description |
|---|---|
| Fields to Synchronize | The fields from the MaxCompute table to include. Select all fields or a subset. |
| Partition Configuration | The partition field to use in Hologres. Hologres supports only single-level partitioning. For MaxCompute tables with multi-level partitions, one level becomes the Hologres partition, and the remaining levels are mapped to regular fields. |
| Index Configuration | The indexes to build on the destination table. For details, see Table creation overview. |
SQL script
The SQL Script panel displays the SQL statement generated from your current configuration. Review it to verify the generated logic before running the task.
Step 3: Save the configuration
Click the
icon to save the node configuration.
Step 4: Run the sync task
Click the
icon to start the synchronization. The task imports MaxCompute table data into the Hologres internal table.
Step 5: Verify the imported data
In the left navigation pane, click the
icon to go to the table management page.Double-click the Hologres internal table that you want to view. The table configuration page appears.
If the destination table does not appear on the table management page, perform metadata acquisition for your Hologres instance in DataWorks Data Map. For more information, see Data Map.
Step 6: (Optional) Schedule the task
To refresh the data automatically on a recurring schedule:
Click Scheduling Configuration on the right side of the node configuration page and set the scheduling properties. For details, see Configure basic properties.
Click the
icon to save the node.Click the
icon to commit the node.In the Commit New Version dialog box, enter a description in the Change description field and click OK.
Next steps
To import MaxCompute data using SQL statements instead of the GUI, see Replicate MaxCompute data to internal table.