This topic describes how to use DataStudio to import MaxCompute data to Hologres with a few clicks.
Prerequisites
A Hologres data source is added to your DataWorks workspace and is associated with DataStudio. For more information, see Associate a Hologres instance with a workspace.
Background information
DataStudio allows you to import MaxCompute data with a few clicks. You can import MaxCompute data and query the imported data in a visualized manner. This method provides better performance than the method of creating foreign tables for data queries.
You can also import MaxCompute data by executing SQL statements. For more information, see Import data from MaxCompute to Hologres by executing SQL statements.
Procedure
Create a Data Synchronization from MaxCompute node.
Log on to the DataWorks console.
In the left-side navigation pane, click Workspaces.
In the top navigation bar, select the region where the desired workspace resides. On the Workspaces page, find the workspace and choose Shortcuts > Data Development in the Actions column.
In the left-side navigation pane of the DataStudio page, click Scheduled Workflow.
In the top navigation bar of the Scheduled Workflow pane, move the pointer over the Create icon and choose Create Node > Hologres > Data Synchronization from MaxCompute.
In the Create Node dialog box, configure the Engine Instance, Path, and Name parameters, and click Confirm. The configuration tab of the node appears.
On the configuration tab of the node, configure parameters. The following table describes the parameters.
Section
Parameter
Description
Select MaxCompute Source Table
Destination Name
The name of the Hologres data source that is associated with DataStudio.
Destination Database
The name of the database in the Hologres instance.
Source Of External Table
Existing External Table
The foreign table that is used to map MaxCompute data exists in Hologres.
Create External Table
No foreign table exists. You need to create a foreign table.
External Schema
The name of the schema in which the foreign table that maps the MaxCompute table resides.
This parameter is available if you set the Source of External Table parameter to Existing External Table.
External Table Name
The name of the foreign table that maps the MaxCompute table.
This parameter is available if you set the Source of External Table parameter to Existing External Table.
External Server
After a Hologres instance is created, a server named odps_server is automatically created and can be used. For more information, see postgres_fdw.
This parameter is available if you set the Source of External Table parameter to Create External Table.
MaxCompute project
The name of the MaxCompute project from which you want to import data.
This parameter is available if you set the Source of External Table parameter to Create External Table.
MaxCompute Table Name
The name of the MaxCompute table from which you want to import data.
This parameter is available if you set the Source of External Table parameter to Create External Table.
Destination Table Settings
Destination Schema
The name of the schema to which the destination table belongs.
Target Table
The name of the destination Hologres table to which you want to import data. If a Hologres table with the same name exists, the original table and data in the table are automatically deleted after the Data Synchronization from MaxCompute node is run.
Destination Table Description
The description of the destination Hologres table to which you want to import data.
Configure GUC Parameters for Data Import
GUC Parameters
The Grand Unified Configuration (GUC) parameters that you must configure before you import data from MaxCompute to Hologres. For more information about the GUC parameters that are supported by Hologres, see GUC parameters. Other SQL statements are not supported.
Synchronization Settings
Synchronization Field
The fields in the MaxCompute table that you want to import. You can select all or some of the fields.
Partition Configurations
The partition fields that you want to import. Hologres only supports one level of partitions.
If you import data from a MaxCompute table that involves multiple levels of partitions, you must specify the level-1 partition field of the MaxCompute table for the destination table. Other partition fields in the MaxCompute table are mapped to common fields in the destination table.
Index configuration
The indexes that you want to create for the destination table. For more information about how to create an index, see CREATE TABLE.
SQL Script
SQL Script
The SQL statements that need to be executed when the data synchronization node is run.
On the node configuration tab, click the icon to save the configurations.
On the node configuration tab, click the icon to run the synchronization node to import MaxCompute data.
View the synchronized MaxCompute table data.
In the left-side navigation pane of the DataStudio page, click the icon to go to the Workspace Tables pane.
Double-click the destination Hologres table to go to the table configuration tab.
NoteIf the destination table is not displayed in the Workspace Tables pane, you must collect Hologres metadata in Data Map. For more information, see Data Map (Beta).
Optional. Configure periodic scheduling.
Click Properties in the right-side navigation pane of the configuration tab of the node to configure scheduling properties for the node. For more information, see Configure basic properties.
On the node configuration tab, click the icon in the top toolbar to save the node.
Click the icon in the top toolbar to commit the node.
In the Commit Node dialog box, enter a description in the Change description field and click OK.