Before you can build an offline data warehouse, you must prepare the necessary cloud resources. This includes activating and configuring the MaxCompute compute source, along with preparing data sources. This guide will walk you through the necessary cloud resource preparations for this tutorial.
Step 1: MaxCompute activation and configuration
Main flow | Description | Operation guide |
Activate MaxCompute | Purchase MaxCompute. | |
Create MaxCompute project | Create a MaxCompute project with the project name dataphin_tutorial. Important MaxCompute uses a global project space. Once created, a project space cannot be created again. It is recommended to use names like dataphin_tutorial_001. | |
Set Dataphin compute engine | Set the compute engine of Dataphin to MaxCompute. |
Step 2: Prepare data source
Create a MySQL 8.0 instance through RDS, retrieve the RDS instance ID, and configure a whitelist in the RDS console. For more information, see Configure Databases. In this tutorial, we use 'dataphin_tutorial' as the example RDS data source name.
Log in to the MySQL instance and execute the following commands to create a database and data tables.
create database dataphin; //Create dataphin database //Product table CREATE TABLE product ( product_id INT PRIMARY KEY COMMENT 'Product ID', product_name VARCHAR(100) COMMENT 'Product name', product_category VARCHAR(100) COMMENT 'Product category', product_price DECIMAL(10, 2) COMMENT 'Product price' ); //Insert product table data INSERT INTO product(product_id, product_name, product_category, product_price) values(1001,'West Lake Longjing','Green tea',20); INSERT INTO product(product_id, product_name, product_category, product_price) values(1002,'Guizhou Meitan','Green tea',22); INSERT INTO product(product_id, product_name, product_category, product_price) values(1003,'Da Hong Pao','Oolong tea',100); //Customer table CREATE TABLE customer ( customer_id INT PRIMARY KEY COMMENT 'Customer ID', customer_name VARCHAR(100) COMMENT 'Customer name' ); //Insert customer data INSERT INTO customer(customer_id, customer_name) VALUES (1001001,'Shanshan'); INSERT INTO customer(customer_id, customer_name) VALUES (1001002,'Maomao'); INSERT INTO customer(customer_id, customer_name) VALUES (1001003,'Xixi'); //Order table CREATE TABLE orders ( order_id INT PRIMARY KEY COMMENT 'Order ID', customer_id INT COMMENT 'Customer ID', product_id INT COMMENT 'Product ID', order_time DATE COMMENT 'Order date', payment_amount DECIMAL(10, 2) COMMENT 'Order amount', FOREIGN KEY (product_id) REFERENCES product(product_id), FOREIGN KEY (customer_id) REFERENCES customer(customer_id) ); //Insert order data INSERT INTO orders(order_id, customer_id, product_id, order_time, payment_amount) VALUES (003,1001001,1001,curdate(),20); INSERT INTO orders(order_id, customer_id, product_id, order_time, payment_amount) VALUES (004,1001001,1001,curdate(),20);