Because the data ingestion feature in DLF is no longer updated, this topic shows you how to use DataWorks data integration to ingest data from an ApsaraDB RDS for MySQL instance. You will also learn how to create an external project in MaxCompute to query table data managed by DLF.
Limitations
The data lakehouse solution is supported only in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Shenzhen), China (Hong Kong), Singapore, and Germany (Frankfurt).
MaxCompute, OSS, ApsaraDB RDS, and DLF must be deployed in the same region.
Ingest MySQL data into a data lake
For details on data ingestion in DLF, see Quick start.
Step 1: Create a data lake metadatabase
Log on to the DLF console. In the top navigation bar, select a region. In the left-side navigation pane, choose and create a metadatabase. For more information, see Databases, tables, and functions.
Step 2: Import data to OSS with DataWorks
Prepare the source data.
Log on to the ApsaraDB RDS console, select a region, and then click Instances in the left-side navigation pane.
Select the target ApsaraDB RDS instance and log on to the database.
Create a table in the ApsaraDB RDS database and insert some test data. For more information, see Use DMS to log on to an ApsaraDB RDS for MySQL instance. For example, you can create a table named rds_mc with the following SQL statements:
CREATE TABLE `rds_mc` ( `id` varchar(32) , `name` varchar(32) , PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `rds_mc`(`id` ,`name` ) VALUES(1,"Alice"); INSERT INTO `rds_mc`(`id` ,`name` ) VALUES(2,"zhangsan"); INSERT INTO `rds_mc`(`id` ,`name` ) VALUES(3,"zhaosi"); INSERT INTO `rds_mc`(`id` ,`name` ) VALUES(4,"wangwu"); INSERT INTO `rds_mc`(`id` ,`name` ) VALUES(5,"55555"); INSERT INTO `rds_mc`(`id` ,`name` ) VALUES(8,"6666"); SELECT * FROM `rds_mc`;
Prepare an ApsaraDB RDS for MySQL data source.
Configure a MySQL data source in DataWorks. For more information, see Configure a MySQL data source.
Prepare an OSS data source.
Configure an OSS data source in DataWorks. For more information, see Configure an OSS data source.
Create and run a data synchronization task.
Create a batch synchronization task in the DataStudio module of DataWorks. For more information, see Configure a synchronization task in wizard mode. The following are key configurations:
Network and resource settings

Parameter
Description
Source
Data source type
MySQL.
Data source name
The MySQL data source that you created.
Resource group
My Resource Group
The exclusive resource group for Data Integration that you created.
Destination
Data source type
OSS.
Data source name
The OSS data source that you created.
Configure the task.
On the Configure tasks tab, specify the table and filename.
Parameter
Description
Table
The name of the table that is created in the ApsaraDB RDS database.
File name (with path)
Format: <Directory created in OSS>/<Data file to be exported to OSS>.
Example:
doc-test-01/datalake/anti.csv.Click the
icon in the upper-left corner of the configuration page to save the task, and then click the
icon to run the task.After the task runs successfully, verify that the data was imported to your configured OSS path.
Step 3: Discover metadata with DLF
In the DLF console, use metadata discovery to ingest the data. For more information, see Metadata discovery.
Step 4: View data lake metadata
In the DLF console, click MetaData > Metadata Management, go to the target database, and view the table information on the Table List tab.
If the serialization method for the table after metadata discovery is org.apache.hadoop.hive.serde2.OpenCSVSerde, MaxCompute may misinterpret the field types as an opencsv-specific string type instead of a standard string type. This can cause query failures. To resolve this issue, you must manually change the data type of all affected fields to string in DLF.
Authorization
Building a data lakehouse with MaxCompute, DLF, and OSS requires authorization because the account used to create the MaxCompute project lacks default access to DLF and OSS. Grant permissions using one of the following methods:
One-click authorization: Recommended if you use the same account for the MaxCompute project, DLF, and OSS. Click Authorize DLF and OSS to grant the required permissions.
Custom authorization: This method can be used with either the same or different accounts for the MaxCompute project, DLF, or OSS. For more information, see Custom authorization.
Create an external project in MaxCompute
Create an external project in the DataWorks console.
Log on to the DataWorks console and select the China (Shanghai) region.
In the left-side navigation pane of the DataWorks console, choose .
On the Lake and Warehouse Integration (Data Lakehouse) page, click Start.
On the Create Data Lakehouse page, follow the on-screen instructions. The following tables provide example parameter configurations.
Table 1. Create a data warehouse
Parameter
Example
External Project Name
ext_dlf_delta
MaxCompute Project
ms_proj1
Table 2. Create an external data lake connection
Parameter
Example
Heterogeneous Data Platform Type
Select Alibaba Cloud DLF+OSS data lake connection
Not applicable
Alibaba Cloud DLF+OSS data lake connection
External Project Description
Not applicable
DLF region
cn-shanghai
DLF endpoint
dlf-share.cn-shanghai.aliyuncs.com
DLF database name
datalake
DLF RoleARN
Not applicable
Click Create and then click Preview.
If you can preview the tables from the DLF database, the creation was successful.
Query external project data with MaxCompute
In the DataWorks ad hoc query page, query the table data in the external project.
For more information about ad hoc queries in DataWorks, see Use ad hoc queries to run SQL statements.
Sample command:
select * from ext_dlf_delta.rds_mc;Result: The command returns the data records from the
idandnamecolumns of therds_mctable. This confirms that the data lake metadata was synchronized successfully.