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 DataWorks 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 using SQL.
Procedure
-
Create a Data Synchronization from MaxCompute node.
Log on to the DataWorks console. In the target region, click in the left-side navigation pane. Select a workspace from the drop-down list and click Go to Data Development.
-
In the left-side navigation pane of the DataStudio page, click the
icon to go to the DataStudio page. -
In the top menu bar, click Create and choose Create Node > Hologres > Data Synchronization from MaxCompute.
-
In the Create Node dialog box, select an engine instance and a Path, enter a Name, and click OK.
-
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.
You must configure this parameter when Source Table Type is set to Existing Foreign Table.
External Table Name
The name of the foreign table that maps the MaxCompute table.
You must configure this parameter when Source Table Type is set to Existing Foreign 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.
You must configure this parameter when Source Table Type is set to Create Foreign Table.
MaxCompute Project
The name of the MaxCompute project from which you want to import data.
You must configure this parameter when Source Table Type is set to Create Foreign Table.
MaxCompute Table Name
The name of the MaxCompute table from which you want to import data.
You must configure this parameter when Source Table Type is set to Create Foreign 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.
-
Optional. Configure periodic scheduling.
-
On the node configuration tab, click Schedule Configuration in the right-side panel to set the scheduling configuration 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.
-