Start the FLINK_SQL real-time instance and insert test data to verify the computational results.
Step 1: Start the real-time task
-
On the Dataphin home page, single click Development in the top menu bar.
-
Follow the operation guide in the figure below to start the flink_dataphin real-time task.

-
In the startup dialog box, configure the following parameters:
Parameter
Description
Startup Mode
Choose Stateless startup.
Specify The Data Read Point Of The Source Table
Select Current date and time.
Time Parameter Configuration
Choose Current date.
-
Click OK.
Step 2: Insert data
Connect to the MySQL instance for the flink_dataphin data source and run the following commands to insert data and verify the real-time task results.
//Create a function to generate product types
CREATE FUNCTION getSkuId() RETURNS VARCHAR(20)
BEGIN
DECLARE sku_id VARCHAR(20);
SET sku_id = CASE FLOOR(RAND() * 3)
WHEN 0 THEN 'Green Tea'
WHEN 1 THEN 'Black Tea'
WHEN 2 THEN 'Herbal Tea'
ELSE 'Data generation error'
END;
RETURN sku_id;
END;
//Execute data insertion every 3 seconds
DELIMITER $$
CREATE PROCEDURE executeStatement3000Times()
BEGIN
DECLARE i INT DEFAULT 0;
WHILE i < 1000 DO
INSERT INTO oms_orders(id, buyer_id,sku_type,sku_quantity, gmt_create) VALUES (default,FLOOR(RAND() * 10),getSkuId(),FLOOR(RAND() * 10),current_timestamp());
SET i = i + 1;
SELECT SLEEP(3);
END WHILE;
END $$
DELIMITER ;
//Execute the PROCEDURE to generate and insert data
CALL executeStatement3000Times();
该文章对您有帮助吗?