DataWorks allows you to use DataStudio to quickly create multiple Hologres external tables that mirror the schemas of your MaxCompute tables. You can then use these external tables to run accelerated queries on your MaxCompute data.
Background
Hologres is an end-to-end real-time data warehousing service developed by Alibaba Cloud. It seamlessly connects with MaxCompute and accelerates queries on MaxCompute data through external tables.
DataWorks provides a visual interface to synchronize schemas from MaxCompute to Hologres by using the IMPORT FOREIGN SCHEMA statement.
Prerequisites
Limitations
This feature supports accelerated queries only for data in MaxCompute internal tables. It does not support accelerated queries for data in MaxCompute external tables or views.
The examples in this topic are based on the China (Shanghai) region. The UI in other regions may differ.
Access the schema synchronization page
-
Go to the Data Studio page.
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 Integration.
-
Create a Workflow.
If you have an existing Workflow, skip this step.
-
Hover over the
icon and select Create Workflow. -
In the Create Workflow dialog box, enter a Workflow Name.
-
Click Create.
-
-
Create a Schema Synchronization from MaxCompute node.
-
Hover over the
icon and choose .Alternatively, find the target workflow, right-click the workflow, and choose .
-
In the Create Node dialog box, enter a Name and select an Compute Engine Instance, Node Type, and Path.
-
Click OK to go to the node configuration page.
-
Configure the schema synchronization node
-
Configure the node.
On the node configuration page, configure the connection information for the destination Hologres instance, the source MaxCompute tables, and policies for handling conflicts during table creation. The node configuration page consists of three parts: ① Destination information: Set destination connection, destination database, and schema. You can click table management to go to the management page. ② Source (Batch create tables based on the following data): Set Type to MaxCompute, configure the server list and source project, and select either All Tables in Database or Selected Tables as the acceleration method. ③ Advanced options: Configure policies for handling table name conflicts and unsupported data types.
-
Configure destination information.
Specify the Hologres instance in which to create the Hologres external tables.
Parameter
Description
Destination Name
The name of the Hologres instance.
Destination Database
The name of the database in the Hologres instance.
Schema
The name of the schema in the Hologres database. The default value is public.
-
Configure source information.
Specify the source MaxCompute tables whose schemas you want to replicate.
Parameter
Description
Type
Currently, only MaxCompute source tables are supported.
Servers
The server where the source tables are located.
You can directly call the odps_server foreign server that is already created in the underlying layer of Hologres. For more information about the principles, see postgres_fdw.
Source Project
The name of the project where the source tables are located.
Select Tables for Query Acceleration
Select the source tables from which to create external tables.
-
All Tables in Database: Creates external tables for all tables in the selected database.
-
Selected Tables: Select specific tables from the database. You can search for tables by name.
NoteThe search finds all tables whose names contain the keyword.
-
-
Configure conflict policies.
Specify the policies for handling conflicts that may occur when you create the external tables.
Parameter
Description
Action for Table Name Conflicts
This policy determines what to do if a table with the same name already exists in Hologres. The following options are available:
-
Ignore, continue creating other tables.
-
Update, modify the table with the same name.
-
Report error, do not create duplicate table.
Data type not supported
This policy determines how to handle data types in the source table that are not supported by Hologres. The following options are available:
-
Report error, import fails: This option causes table creation to fail.
-
Ignore, skip unsupported fields: The table is created without the unsupported fields.
-
-
-
Save and run the node.
-
In the top menu bar of the node configuration page, click the
icon to save the node configuration. -
In the top menu bar of the node configuration page, click the
icon to batch-create the external tables.
-
When you run the node, you must select a serverless resource group that is connected to both the Hologres instance and the DataWorks network. For more information, see Network connectivity solutions.
Next steps
After the external tables are created, you can go to the Table Management page in DataWorks to view the newly created external tables. For more information, see Table management. You can also use Hologres commands to run accelerated queries on MaxCompute data. For more information, see Accelerate queries on MaxCompute data based on a foreign table.
This feature supports accelerated queries only for data in MaxCompute internal tables. It does not support accelerated queries for data in MaxCompute external tables or views.