×
Community Blog Hands-on Labs | Get Started with Flink MySQL Connector in 5 Minutes

Hands-on Labs | Get Started with Flink MySQL Connector in 5 Minutes

This step-by-step tutorial introduces how to get started with Flink MySQL Connector in 5 minutes.

>> Get hands-on experience with this tutorial in a lab environment.


1. Activate Required Resources for the Lab

Before starting the lab, please make sure you have activate the following services:

Object Storage Service (OSS)

Virtual Private Cloud (VPC)

Realtime Compute for Apache Flink

ApsaraDB RDS MySQL Serverless

Please note: OSS and Flink offer free tier to eligible users. If you are eligible for free tier, please visit the Free Tier page to activate the resouces.

2. Create Database, Database Account, and Obtain Database Access Address

The steps will guide you through creating a database and an account on the ApsaraDB RDS for MySQL Serverless edition instance and obtaining the database access endpoint.

1.  Proceed to the ApsaraDB RDS console.

2.  In the left-side navigation pane, click on Instances.

1

Return to the following page, where you can view the resources of the RDS MySQL Serverless edition instance you just created.

2

3.  Create Database.

3.1 On the Instance list page, click on the Instance ID to enter the basic information page for the instance. In the left navigation pane. Click on Database to create a database.

3
4

3.2 In the Create Database dialogue, configure the database according to the following instructions, and then click Create.

Parameter Description:

Database (DB) Name: Enter the name of the database, for example, 'serverless'.

Character Set Support: Set to 'utf8' by default.

Description: This is optional. It is used to note relevant information about the database for easier management later on. Supports up to 256 characters.

5

4.  Create an Account and Grant Permissions.

4.1 Click on Accounts in the left navigation pane to create a database account and complete the authorization process.

6

Database Account: Enter a username for the database account, for example, test_user.

Account Type: Select Standard Account.

Authorized Database: Add the database created in the previous step to the list of authorized databases and assign it Read-Write (DDL+DML) permissions.

New Password: Enter the password for the account, such as Password123.

Confirm Password: Re-enter the password for the account.

7

5.  Obtain Database Access Endpoint.

8

3. Retrieve the Database Endpoint (Access Address)

In this lab, we will create three tables in the database on the RDS MySQL Serverless edition instance, to serve as a source table, dimension table, and sink table, respectively, demonstrating the various functionalities of the MySQL Connector.

1.  On the Account Management page, click on Log On to Database.

9

2.  Enter the Database account and Password in the Log On to Instance dialogue box, then click Test Connection. Once the connection test is successful, click on Login.

10

3.  On the home page, click Database Instance on the left side, locate the database you created within the logged-in instances, and double-click on the serverless.

11

4.  In the SQL Console tab, enter the following SQL statements for creating tables, and then click Execute to create three tables to serve as the source table, dimension table, and sink table, respectively.

-- Source Table;
CREATE TABLE `source_table` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `good_id` int DEFAULT NULL,
  `amount` int DEFAULT NULL,
  `record_time` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
);

-- Dimension Table;
CREATE TABLE `dimension_table` (
  `good_id` int unsigned NOT NULL,
  `good_name` varchar(256) DEFAULT NULL,
  `good_price` int DEFAULT NULL,
  PRIMARY KEY (`good_id`)
);

-- Sink Table;
CREATE TABLE `sink_table` (
  `record_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `good_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `sell_amount` int DEFAULT NULL,
  PRIMARY KEY (`record_timestamp`)
);

12
13

If the following results are returned, it indicates that the three tables have been created successfully.

14

5.  Insert Data. Multiple data entries need to be inserted into the database. Enter the following statement and click Execute.

Please note: You can execute the example_data.sql file included in the attachments to insert data into RDS, or you can use the example_data_generation.py script to insert data in real-time.

INSERT INTO `dimension_table` (`good_id`, `good_name`, `good_price`)
VALUES
    (1, 'Cheetah', 53),
    (2, 'Puma', 46),
    (3, 'Jaguar', 22),
    (4, 'Panther', 18),
    (5, 'Tiger', 99),
    (6, 'Leopard', 84),
    (7, 'Snow Leopard', 81),
    (8, 'Lion', 17),
    (9, 'Mountain Lion', 19),
    (10, 'Mavericks', 77),
    (11, 'Yosemite', 16),
    (12, 'El Capitan', 16),
    (13, 'Sierra', 85),
    (14, 'High Sierra', 87),
    (15, 'Mojave', 51),
    (16, 'Catalina', 92),
    (17, 'Big Sur', 14),
    (18, 'Monterey', 99),
    (19, 'Ventura', 15),
    (20, 'Sonoma', 68);

INSERT INTO `source_table` (`id`, `good_id`, `amount`, `record_time`)
VALUES
    (1, 16, 19, '2023-06-09 11:06:34'),
    (2, 8, 20, '2023-06-09 11:06:35'),
    (3, 19, 24, '2023-06-09 11:06:36'),
    (4, 17, 23, '2023-06-09 11:06:37'),
    (5, 2, 25, '2023-06-09 11:06:40'),
    (6, 10, 28, '2023-06-09 11:06:44'),
    (7, 20, 26, '2023-06-09 11:06:48'),
    (8, 18, 19, '2023-06-09 11:06:49'),
    (9, 16, 21, '2023-06-09 11:06:53'),
    (10, 7, 19, '2023-06-09 11:06:55'),
    (11, 7, 20, '2023-06-09 11:06:59'),
    (12, 17, 21, '2023-06-09 11:07:03'),
    (13, 2, 19, '2023-06-09 11:07:05'),
    (14, 5, 22, '2023-06-09 11:07:08'),
    (15, 10, 21, '2023-06-09 11:07:12'),
    (16, 2, 29, '2023-06-09 11:07:16'),
    (17, 6, 27, '2023-06-09 11:07:19'),
    (18, 16, 23, '2023-06-09 11:07:23'),
    (19, 8, 20, '2023-06-09 11:07:24'),
    (20, 8, 31, '2023-06-09 11:07:26'),
    (21, 6, 30, '2023-06-09 11:07:29'),
    (22, 7, 21, '2023-06-09 11:07:32'),
    (23, 2, 22, '2023-06-09 11:07:33'),
    (24, 9, 23, '2023-06-09 11:07:37'),
    (25, 19, 29, '2023-06-09 11:07:41'),
    (26, 16, 31, '2023-06-09 11:07:45'),
    (27, 13, 19, '2023-06-09 11:07:48'),
    (28, 6, 20, '2023-06-09 11:07:50'),
    (29, 4, 20, '2023-06-09 11:07:52'),
    (30, 4, 25, '2023-06-09 11:07:54'),
    (31, 4, 20, '2023-06-09 11:07:55'),
    (32, 4, 21, '2023-06-09 11:07:58'),
    (33, 11, 24, '2023-06-09 11:07:59'),
    (34, 1, 24, '2023-06-09 11:08:03'),
    (35, 7, 31, '2023-06-09 11:08:06'),
    (36, 2, 27, '2023-06-09 11:08:10'),
    (37, 19, 26, '2023-06-09 11:08:13'),
    (38, 3, 23, '2023-06-09 11:08:15'),
    (39, 11, 20, '2023-06-09 11:08:19'),
    (40, 20, 21, '2023-06-09 11:08:23'),
    (41, 7, 22, '2023-06-09 11:08:25'),
    (42, 5, 21, '2023-06-09 11:08:29'),
    (43, 7, 22, '2023-06-09 11:08:30'),
    (44, 11, 28, '2023-06-09 11:08:31'),
    (45, 2, 19, '2023-06-09 11:08:32'),
    (46, 1, 26, '2023-06-09 11:08:36'),
    (47, 3, 31, '2023-06-09 11:08:39'),
    (48, 20, 20, '2023-06-09 11:08:41'),
    (49, 6, 24, '2023-06-09 11:08:43'),
    (50, 10, 28, '2023-06-09 11:08:44'),
    (51, 11, 21, '2023-06-09 11:08:48'),
    (52, 9, 20, '2023-06-09 11:08:52'),
    (53, 5, 28, '2023-06-09 11:08:53'),
    (54, 8, 28, '2023-06-09 11:08:54'),
    (55, 15, 26, '2023-06-09 11:08:58'),
    (56, 3, 26, '2023-06-09 11:09:01'),
    (57, 19, 20, '2023-06-09 11:09:02'),
    (58, 6, 22, '2023-06-09 11:09:03'),
    (59, 1, 22, '2023-06-09 11:09:05'),
    (60, 19, 25, '2023-06-09 11:09:08'),
    (61, 17, 28, '2023-06-09 11:09:11'),
    (62, 5, 25, '2023-06-09 11:09:12'),
    (63, 16, 30, '2023-06-09 11:09:16'),
    (64, 1, 23, '2023-06-09 11:09:17'),
    (65, 1, 22, '2023-06-09 11:09:21'),
    (66, 3, 19, '2023-06-09 11:09:22'),
    (67, 10, 19, '2023-06-09 11:09:24'),
    (68, 12, 20, '2023-06-09 11:09:26'),
    (69, 18, 20, '2023-06-09 11:09:29'),
    (70, 16, 21, '2023-06-09 11:09:32'),
    (71, 4, 27, '2023-06-09 11:09:33'),
    (72, 14, 31, '2023-06-09 11:09:37'),
    (73, 15, 30, '2023-06-09 11:09:40'),
    (74, 8, 24, '2023-06-09 11:09:43'),
    (75, 2, 24, '2023-06-09 11:09:44'),
    (76, 4, 31, '2023-06-09 11:09:45'),
    (77, 15, 25, '2023-06-09 11:09:49'),
    (78, 1, 28, '2023-06-09 11:09:53'),
    (79, 9, 29, '2023-06-09 11:09:56'),
    (80, 3, 30, '2023-06-09 11:09:57'),
    (81, 9, 20, '2023-06-09 11:09:58'),
    (82, 9, 23, '2023-06-09 11:10:01'),
    (83, 2, 30, '2023-06-09 11:10:03'),
    (84, 16, 26, '2023-06-09 11:10:04'),
    (85, 17, 21, '2023-06-09 11:10:05'),
    (86, 14, 25, '2023-06-09 11:10:08'),
    (87, 3, 22, '2023-06-09 11:10:10'),
    (88, 14, 24, '2023-06-09 11:10:11'),
    (89, 9, 21, '2023-06-09 11:10:12'),
    (90, 8, 19, '2023-06-09 11:10:16'),
    (91, 20, 28, '2023-06-09 11:10:17'),
    (92, 15, 30, '2023-06-09 11:10:19'),
    (93, 6, 21, '2023-06-09 11:10:21'),
    (94, 10, 26, '2023-06-09 11:10:22'),
    (95, 10, 30, '2023-06-09 11:10:25'),
    (96, 5, 25, '2023-06-09 11:10:29'),
    (97, 7, 19, '2023-06-09 11:10:33'),
    (98, 4, 19, '2023-06-09 11:10:36'),
    (99, 5, 28, '2023-06-09 11:10:38'),
    (100, 19, 19, '2023-06-09 11:10:41'),
    (101, 18, 27, '2023-06-09 11:10:44'),
    (102, 19, 23, '2023-06-09 11:10:46'),
    (103, 9, 28, '2023-06-09 11:10:47'),
    (104, 15, 19, '2023-06-09 11:10:49'),
    (105, 9, 19, '2023-06-09 11:10:51'),
    (106, 3, 23, '2023-06-09 11:10:52'),
    (107, 12, 28, '2023-06-09 11:10:54'),
    (108, 5, 25, '2023-06-09 11:10:56'),
    (109, 7, 30, '2023-06-09 11:11:00'),
    (110, 13, 28, '2023-06-09 11:11:01'),
    (111, 8, 29, '2023-06-09 11:11:03'),
    (112, 7, 26, '2023-06-09 11:11:04'),
    (113, 2, 23, '2023-06-09 11:11:07'),
    (114, 5, 25, '2023-06-09 11:11:08'),
    (115, 4, 27, '2023-06-09 11:11:10'),
    (116, 7, 25, '2023-06-09 11:11:12'),
    (117, 17, 26, '2023-06-09 11:11:14'),
    (118, 6, 31, '2023-06-09 11:11:17'),
    (119, 6, 27, '2023-06-09 11:11:20'),
    (120, 20, 30, '2023-06-09 11:11:23'),
    (121, 1, 24, '2023-06-09 11:11:26'),
    (122, 1, 27, '2023-06-09 11:11:30'),
    (123, 3, 28, '2023-06-09 11:11:31'),
    (124, 20, 30, '2023-06-09 11:11:32'),
    (125, 1, 31, '2023-06-09 11:11:33'),
    (126, 9, 21, '2023-06-09 11:11:37'),
    (127, 12, 24, '2023-06-09 11:11:39'),
    (128, 17, 30, '2023-06-09 11:11:40'),
    (129, 13, 26, '2023-06-09 11:11:43'),
    (130, 5, 23, '2023-06-09 11:11:44'),
    (131, 1, 28, '2023-06-09 11:11:45'),
    (132, 16, 22, '2023-06-09 11:11:46'),
    (133, 8, 21, '2023-06-09 11:11:47'),
    (134, 15, 20, '2023-06-09 11:11:50'),
    (135, 8, 28, '2023-06-09 11:11:53'),
    (136, 16, 25, '2023-06-09 11:11:57'),
    (137, 14, 31, '2023-06-09 11:11:58'),
    (138, 11, 25, '2023-06-09 11:12:00'),
    (139, 6, 31, '2023-06-09 11:12:03'),
    (140, 1, 27, '2023-06-09 11:12:07'),
    (141, 11, 21, '2023-06-09 11:12:09'),
    (142, 8, 24, '2023-06-09 11:12:12'),
    (143, 11, 24, '2023-06-09 11:12:14'),
    (144, 9, 24, '2023-06-09 11:12:18'),
    (145, 16, 23, '2023-06-09 11:12:21'),
    (146, 4, 21, '2023-06-09 11:12:25'),
    (147, 19, 25, '2023-06-09 11:12:29'),
    (148, 5, 22, '2023-06-09 11:12:32'),
    (149, 14, 28, '2023-06-09 11:12:34'),
    (150, 8, 25, '2023-06-09 11:12:35'),
    (151, 10, 30, '2023-06-09 11:12:39'),
    (152, 4, 24, '2023-06-09 11:12:41'),
    (153, 12, 29, '2023-06-09 11:12:43'),
    (154, 9, 20, '2023-06-09 11:12:47'),
    (155, 13, 19, '2023-06-09 11:12:48'),
    (156, 11, 20, '2023-06-09 11:12:50'),
    (157, 5, 22, '2023-06-09 11:12:54'),
    (158, 16, 28, '2023-06-09 11:12:57'),
    (159, 2, 21, '2023-06-09 11:13:01'),
    (160, 11, 19, '2023-06-09 11:13:03'),
    (161, 15, 19, '2023-06-09 11:13:04'),
    (162, 4, 24, '2023-06-09 11:13:06'),
    (163, 11, 27, '2023-06-09 11:13:08'),
    (164, 12, 20, '2023-06-09 11:13:09'),
    (165, 6, 29, '2023-06-09 11:13:11'),
    (166, 11, 21, '2023-06-09 11:13:15'),
    (167, 10, 28, '2023-06-09 11:13:17'),
    (168, 15, 21, '2023-06-09 11:13:18'),
    (169, 1, 20, '2023-06-09 11:13:22'),
    (170, 15, 24, '2023-06-09 11:13:24'),
    (171, 1, 26, '2023-06-09 11:13:28'),
    (172, 5, 23, '2023-06-09 11:13:31'),
    (173, 4, 23, '2023-06-09 11:13:33'),
    (174, 13, 30, '2023-06-09 11:13:37'),
    (175, 12, 28, '2023-06-09 11:13:41'),
    (176, 18, 27, '2023-06-09 11:13:42'),
    (177, 10, 29, '2023-06-09 11:13:45'),
    (178, 9, 21, '2023-06-09 11:13:47'),
    (179, 19, 20, '2023-06-09 11:13:50'),
    (180, 1, 21, '2023-06-09 11:13:54'),
    (181, 1, 31, '2023-06-09 11:13:58'),
    (182, 11, 30, '2023-06-09 11:13:59'),
    (183, 6, 21, '2023-06-09 11:14:02'),
    (184, 2, 24, '2023-06-09 11:14:04'),
    (185, 18, 29, '2023-06-09 11:14:05'),
    (186, 14, 21, '2023-06-09 11:14:08'),
    (187, 5, 21, '2023-06-09 11:14:10'),
    (188, 2, 30, '2023-06-09 11:14:13'),
    (189, 1, 27, '2023-06-09 11:14:14'),
    (190, 18, 27, '2023-06-09 11:14:17'),
    (191, 10, 26, '2023-06-09 11:14:21'),
    (192, 16, 29, '2023-06-09 11:14:23'),
    (193, 2, 19, '2023-06-09 11:14:24'),
    (194, 13, 30, '2023-06-09 11:14:28'),
    (195, 16, 20, '2023-06-09 11:14:29'),
    (196, 6, 27, '2023-06-09 11:14:31'),
    (197, 19, 27, '2023-06-09 11:14:33'),
    (198, 8, 29, '2023-06-09 11:14:37'),
    (199, 16, 28, '2023-06-09 11:14:39'),
    (200, 14, 25, '2023-06-09 11:14:40'),
    (201, 3, 29, '2023-06-09 11:14:42'),
    (202, 1, 23, '2023-06-09 11:14:44'),
    (203, 10, 19, '2023-06-09 11:14:47'),
    (204, 14, 27, '2023-06-09 11:14:48'),
    (205, 2, 26, '2023-06-09 11:14:51'),
    (206, 19, 24, '2023-06-09 11:14:55'),
    (207, 7, 19, '2023-06-09 11:14:57'),
    (208, 5, 24, '2023-06-09 11:14:59'),
    (209, 20, 24, '2023-06-09 11:15:00'),
    (210, 20, 25, '2023-06-09 11:15:02'),
    (211, 12, 27, '2023-06-09 11:15:03'),
    (212, 14, 31, '2023-06-09 11:15:06'),
    (213, 1, 22, '2023-06-09 11:15:07'),
    (214, 3, 22, '2023-06-09 11:15:09'),
    (215, 16, 27, '2023-06-09 11:15:10'),
    (216, 10, 19, '2023-06-09 11:15:14'),
    (217, 7, 30, '2023-06-09 11:15:15'),
    (218, 2, 22, '2023-06-09 11:15:17'),
    (219, 13, 20, '2023-06-09 11:15:18'),
    (220, 11, 21, '2023-06-09 11:15:22'),
    (221, 15, 26, '2023-06-09 11:15:25'),
    (222, 8, 25, '2023-06-09 11:15:30'),
    (223, 15, 29, '2023-06-09 11:15:32'),
    (224, 13, 24, '2023-06-09 11:15:36'),
    (225, 20, 21, '2023-06-09 11:15:40'),
    (226, 9, 27, '2023-06-09 11:15:42'),
    (227, 18, 25, '2023-06-09 11:15:44'),
    (228, 3, 19, '2023-06-09 11:15:45'),
    (229, 19, 24, '2023-06-09 11:15:46'),
    (230, 13, 26, '2023-06-09 11:15:50'),
    (231, 10, 30, '2023-06-09 11:15:54'),
    (232, 18, 19, '2023-06-09 11:15:57'),
    (233, 10, 27, '2023-06-09 11:15:59'),
    (234, 8, 31, '2023-06-09 11:16:02'),
    (235, 6, 25, '2023-06-09 11:16:06'),
    (236, 1, 19, '2023-06-09 11:16:08'),
    (237, 12, 31, '2023-06-09 11:16:11'),
    (238, 10, 25, '2023-06-09 11:16:14'),
    (239, 8, 24, '2023-06-09 11:16:17'),
    (240, 16, 28, '2023-06-09 11:16:19'),
    (241, 19, 23, '2023-06-09 11:16:20'),
    (242, 18, 30, '2023-06-09 11:16:23'),
    (243, 9, 25, '2023-06-09 11:16:27'),
    (244, 17, 27, '2023-06-09 11:16:30'),
    (245, 17, 24, '2023-06-09 11:16:34'),
    (246, 1, 29, '2023-06-09 11:16:35'),
    (247, 3, 23, '2023-06-09 11:16:39'),
    (248, 1, 25, '2023-06-09 11:16:41'),
    (249, 14, 25, '2023-06-09 11:16:45'),
    (250, 17, 29, '2023-06-09 11:16:49'),
    (251, 15, 26, '2023-06-09 11:16:50'),
    (252, 6, 30, '2023-06-09 11:16:52'),
    (253, 13, 25, '2023-06-09 11:16:53'),
    (254, 20, 27, '2023-06-09 11:16:56'),
    (255, 19, 30, '2023-06-09 11:17:00'),
    (256, 20, 29, '2023-06-09 11:17:03'),
    (257, 4, 26, '2023-06-09 11:17:04'),
    (258, 20, 23, '2023-06-09 11:17:05'),
    (259, 8, 25, '2023-06-09 11:17:08'),
    (260, 3, 24, '2023-06-09 11:17:10'),
    (261, 5, 29, '2023-06-09 11:17:13'),
    (262, 12, 31, '2023-06-09 11:17:15'),
    (263, 2, 21, '2023-06-09 11:17:16'),
    (264, 2, 31, '2023-06-09 11:17:18'),
    (265, 6, 30, '2023-06-09 11:17:20'),
    (266, 18, 20, '2023-06-09 11:17:23'),
    (267, 8, 20, '2023-06-09 11:17:24'),
    (268, 18, 30, '2023-06-09 11:17:25'),
    (269, 9, 28, '2023-06-09 11:17:27'),
    (270, 12, 28, '2023-06-09 11:17:30'),
    (271, 16, 29, '2023-06-09 11:17:31'),
    (272, 20, 30, '2023-06-09 11:17:35'),
    (273, 7, 21, '2023-06-09 11:17:39'),
    (274, 4, 30, '2023-06-09 11:17:42'),
    (275, 6, 26, '2023-06-09 11:17:44'),
    (276, 7, 19, '2023-06-09 11:17:45'),
    (277, 19, 31, '2023-06-09 11:17:46'),
    (278, 16, 30, '2023-06-09 11:17:47'),
    (279, 19, 30, '2023-06-09 11:17:49'),
    (280, 13, 21, '2023-06-09 11:17:52'),
    (281, 18, 22, '2023-06-09 11:17:54'),
    (282, 12, 26, '2023-06-09 11:17:57'),
    (283, 3, 22, '2023-06-09 11:18:01'),
    (284, 1, 22, '2023-06-09 11:18:02'),
    (285, 13, 23, '2023-06-09 11:18:04'),
    (286, 20, 19, '2023-06-09 11:18:09'),
    (287, 11, 27, '2023-06-09 11:18:11'),
    (288, 15, 24, '2023-06-09 11:18:13'),
    (289, 17, 28, '2023-06-09 11:18:16'),
    (290, 19, 23, '2023-06-09 11:18:19'),
    (291, 4, 28, '2023-06-09 11:18:20'),
    (292, 8, 25, '2023-06-09 11:18:22'),
    (293, 9, 29, '2023-06-09 11:18:23'),
    (294, 1, 23, '2023-06-09 11:18:27'),
    (295, 15, 27, '2023-06-09 11:18:29'),
    (296, 2, 24, '2023-06-09 11:18:32'),
    (297, 18, 30, '2023-06-09 11:18:34'),
    (298, 9, 27, '2023-06-09 11:18:35'),
    (299, 2, 19, '2023-06-09 11:18:36'),
    (300, 10, 20, '2023-06-09 11:18:39'),
    (301, 17, 28, '2023-06-09 11:18:43'),
    (302, 7, 30, '2023-06-09 11:18:45'),
    (303, 14, 30, '2023-06-09 11:18:48'),
    (304, 11, 30, '2023-06-09 11:18:52'),
    (305, 8, 29, '2023-06-09 11:18:56'),
    (306, 11, 23, '2023-06-09 11:19:00'),
    (307, 10, 23, '2023-06-09 11:19:04'),
    (308, 14, 26, '2023-06-09 11:19:07'),
    (309, 11, 25, '2023-06-09 11:19:09'),
    (310, 6, 22, '2023-06-09 11:19:11'),
    (311, 12, 27, '2023-06-09 11:19:15'),
    (312, 3, 22, '2023-06-09 11:19:17'),
    (313, 1, 28, '2023-06-09 11:19:18'),
    (314, 18, 24, '2023-06-09 11:19:20'),
    (315, 4, 20, '2023-06-09 11:19:24'),
    (316, 11, 29, '2023-06-09 11:19:25'),
    (317, 11, 30, '2023-06-09 11:19:27'),
    (318, 20, 21, '2023-06-09 11:19:31'),
    (319, 5, 24, '2023-06-09 11:19:33'),
    (320, 20, 20, '2023-06-09 11:19:37'),
    (321, 8, 28, '2023-06-09 11:19:41'),
    (322, 10, 31, '2023-06-09 11:19:43'),
    (323, 15, 19, '2023-06-09 11:19:47'),
    (324, 19, 29, '2023-06-09 11:19:48'),
    (325, 14, 19, '2023-06-09 11:19:51'),
    (326, 3, 23, '2023-06-09 11:19:52'),
    (327, 15, 26, '2023-06-09 11:19:57'),
    (328, 12, 23, '2023-06-09 11:19:58'),
    (329, 7, 28, '2023-06-09 11:20:01'),
    (330, 20, 29, '2023-06-09 11:20:05'),
    (331, 17, 26, '2023-06-09 11:20:09'),
    (332, 10, 19, '2023-06-09 11:20:13'),
    (333, 18, 31, '2023-06-09 11:20:16'),
    (334, 4, 23, '2023-06-09 11:20:18'),
    (335, 7, 21, '2023-06-09 11:20:19'),
    (336, 9, 22, '2023-06-09 11:20:23'),
    (337, 6, 27, '2023-06-09 11:20:26'),
    (338, 19, 28, '2023-06-09 11:20:30'),
    (339, 19, 21, '2023-06-09 11:20:31'),
    (340, 13, 25, '2023-06-09 11:20:33'),
    (341, 17, 26, '2023-06-09 11:20:37'),
    (342, 19, 27, '2023-06-09 11:20:41'),
    (343, 20, 20, '2023-06-09 11:20:42'),
    (344, 10, 24, '2023-06-09 11:20:43'),
    (345, 12, 23, '2023-06-09 11:20:46'),
    (346, 9, 19, '2023-06-09 11:20:47'),
    (347, 15, 21, '2023-06-09 11:20:50'),
    (348, 18, 19, '2023-06-09 11:20:54'),
    (349, 4, 26, '2023-06-09 11:20:56'),
    (350, 3, 24, '2023-06-09 11:20:57'),
    (351, 18, 24, '2023-06-09 11:20:58'),
    (352, 17, 25, '2023-06-09 11:21:02'),
    (353, 16, 31, '2023-06-09 11:21:06'),
    (354, 1, 24, '2023-06-09 11:21:07'),
    (355, 13, 30, '2023-06-09 11:21:11'),
    (356, 3, 30, '2023-06-09 11:21:13'),
    (357, 3, 20, '2023-06-09 11:21:16'),
    (358, 10, 22, '2023-06-09 11:21:19'),
    (359, 17, 27, '2023-06-09 11:21:20'),
    (360, 13, 22, '2023-06-09 11:21:22'),
    (361, 15, 22, '2023-06-09 11:21:25'),
    (362, 17, 30, '2023-06-09 11:21:26'),
    (363, 2, 28, '2023-06-09 11:21:28'),
    (364, 9, 24, '2023-06-09 11:21:30'),
    (365, 9, 23, '2023-06-09 11:21:32'),
    (366, 6, 27, '2023-06-09 11:21:34'),
    (367, 17, 26, '2023-06-09 11:21:38'),
    (368, 8, 30, '2023-06-09 11:21:42'),
    (369, 3, 29, '2023-06-09 11:21:45'),
    (370, 14, 25, '2023-06-09 11:21:47'),
    (371, 9, 25, '2023-06-09 11:21:51'),
    (372, 13, 30, '2023-06-09 11:21:54'),
    (373, 18, 19, '2023-06-09 11:21:58'),
    (374, 6, 21, '2023-06-09 11:22:00'),
    (375, 1, 24, '2023-06-09 11:22:01'),
    (376, 16, 23, '2023-06-09 11:22:02'),
    (377, 17, 23, '2023-06-09 11:22:03'),
    (378, 5, 23, '2023-06-09 11:22:06'),
    (379, 17, 27, '2023-06-09 11:22:09'),
    (380, 20, 30, '2023-06-09 11:22:13'),
    (381, 19, 28, '2023-06-09 11:22:14'),
    (382, 6, 24, '2023-06-09 11:22:18'),
    (383, 17, 28, '2023-06-09 11:22:21'),
    (384, 14, 26, '2023-06-09 11:22:24'),
    (385, 14, 22, '2023-06-09 11:22:26'),
    (386, 10, 27, '2023-06-09 11:22:30'),
    (387, 12, 28, '2023-06-09 11:22:31'),
    (388, 13, 31, '2023-06-09 11:22:35'),
    (389, 9, 25, '2023-06-09 11:22:39'),
    (390, 17, 27, '2023-06-09 11:22:40'),
    (391, 13, 27, '2023-06-09 11:22:41'),
    (392, 4, 26, '2023-06-09 11:22:42'),
    (393, 9, 26, '2023-06-09 11:22:43'),
    (394, 11, 27, '2023-06-09 11:22:46'),
    (395, 18, 22, '2023-06-09 11:22:48'),
    (396, 4, 27, '2023-06-09 11:22:52'),
    (397, 1, 26, '2023-06-09 11:22:56'),
    (398, 5, 27, '2023-06-09 11:22:58'),
    (399, 8, 20, '2023-06-09 11:23:02'),
    (400, 11, 25, '2023-06-09 11:23:04'),
    (401, 16, 22, '2023-06-09 11:23:05'),
    (402, 4, 22, '2023-06-09 11:23:07'),
    (403, 14, 23, '2023-06-09 11:23:11'),
    (404, 2, 27, '2023-06-09 11:23:12'),
    (405, 7, 24, '2023-06-09 11:23:13'),
    (406, 3, 30, '2023-06-09 11:23:16'),
    (407, 14, 25, '2023-06-09 11:23:17'),
    (408, 12, 28, '2023-06-09 11:23:21'),
    (409, 15, 25, '2023-06-09 11:23:24'),
    (410, 8, 22, '2023-06-09 11:23:26'),
    (411, 6, 30, '2023-06-09 11:23:29'),
    (412, 15, 22, '2023-06-09 11:23:31'),
    (413, 15, 19, '2023-06-09 11:23:32'),
    (414, 5, 29, '2023-06-09 11:23:36'),
    (415, 1, 31, '2023-06-09 11:23:38'),
    (416, 18, 28, '2023-06-09 11:23:39'),
    (417, 9, 19, '2023-06-09 11:23:43'),
    (418, 3, 22, '2023-06-09 11:23:45'),
    (419, 4, 19, '2023-06-09 11:23:47'),
    (420, 17, 29, '2023-06-09 11:23:48'),
    (421, 17, 22, '2023-06-09 11:23:50'),
    (422, 15, 30, '2023-06-09 11:23:53'),
    (423, 13, 21, '2023-06-09 11:23:55'),
    (424, 4, 29, '2023-06-09 11:23:56'),
    (425, 10, 27, '2023-06-09 11:23:58'),
    (426, 9, 24, '2023-06-09 11:24:01'),
    (427, 11, 24, '2023-06-09 11:24:04'),
    (428, 5, 28, '2023-06-09 11:24:08'),
    (429, 14, 29, '2023-06-09 11:24:13'),
    (430, 3, 20, '2023-06-09 11:24:14'),
    (431, 8, 22, '2023-06-09 11:24:17'),
    (432, 1, 30, '2023-06-09 11:24:18'),
    (433, 13, 19, '2023-06-09 11:24:21'),
    (434, 1, 23, '2023-06-09 11:24:25'),
    (435, 6, 30, '2023-06-09 11:24:29'),
    (436, 17, 26, '2023-06-09 11:24:33'),
    (437, 8, 23, '2023-06-09 11:24:34'),
    (438, 4, 29, '2023-06-09 11:24:36'),
    (439, 9, 31, '2023-06-09 11:24:37'),
    (440, 18, 23, '2023-06-09 11:24:40'),
    (441, 11, 19, '2023-06-09 11:24:43'),
    (442, 12, 25, '2023-06-09 11:24:45'),
    (443, 7, 26, '2023-06-09 11:24:47'),
    (444, 8, 31, '2023-06-09 11:24:51'),
    (445, 13, 23, '2023-06-09 11:24:55'),
    (446, 13, 22, '2023-06-09 11:24:56'),
    (447, 7, 27, '2023-06-09 11:25:00'),
    (448, 8, 21, '2023-06-09 11:25:01'),
    (449, 1, 25, '2023-06-09 11:25:04'),
    (450, 14, 19, '2023-06-09 11:25:06'),
    (451, 12, 29, '2023-06-09 11:25:08'),
    (452, 16, 26, '2023-06-09 11:25:10'),
    (453, 6, 30, '2023-06-09 11:25:14'),
    (454, 19, 25, '2023-06-09 11:25:15'),
    (455, 15, 24, '2023-06-09 11:25:17'),
    (456, 4, 19, '2023-06-09 11:25:21'),
    (457, 20, 31, '2023-06-09 11:25:25'),
    (458, 14, 31, '2023-06-09 11:25:29'),
    (459, 17, 24, '2023-06-09 11:25:32'),
    (460, 13, 26, '2023-06-09 11:25:35'),
    (461, 17, 28, '2023-06-09 11:25:36'),
    (462, 9, 23, '2023-06-09 11:25:40'),
    (463, 5, 29, '2023-06-09 11:25:42'),
    (464, 9, 28, '2023-06-09 11:25:43'),
    (465, 13, 25, '2023-06-09 11:25:44'),
    (466, 15, 19, '2023-06-09 11:25:47'),
    (467, 2, 19, '2023-06-09 11:25:49'),
    (468, 15, 29, '2023-06-09 11:25:53'),
    (469, 18, 21, '2023-06-09 11:25:55'),
    (470, 14, 21, '2023-06-09 11:25:56'),
    (471, 11, 28, '2023-06-09 11:25:57'),
    (472, 13, 19, '2023-06-09 11:25:58'),
    (473, 8, 23, '2023-06-09 11:25:59'),
    (474, 16, 24, '2023-06-09 11:26:01'),
    (475, 18, 31, '2023-06-09 11:26:05'),
    (476, 12, 20, '2023-06-09 11:26:08'),
    (477, 19, 30, '2023-06-09 11:26:12'),
    (478, 11, 28, '2023-06-09 11:26:15'),
    (479, 9, 30, '2023-06-09 11:26:18'),
    (480, 12, 29, '2023-06-09 11:26:22'),
    (481, 4, 29, '2023-06-09 11:26:25'),
    (482, 13, 31, '2023-06-09 11:26:27'),
    (483, 15, 23, '2023-06-09 11:26:31'),
    (484, 6, 27, '2023-06-09 11:26:35'),
    (485, 14, 31, '2023-06-09 11:26:36'),
    (486, 16, 30, '2023-06-09 11:26:40'),
    (487, 3, 22, '2023-06-09 11:26:43'),
    (488, 17, 19, '2023-06-09 11:26:46'),
    (489, 8, 19, '2023-06-09 11:26:48'),
    (490, 1, 25, '2023-06-09 11:26:49'),
    (491, 13, 31, '2023-06-09 11:26:52'),
    (492, 10, 21, '2023-06-09 11:26:54'),
    (493, 9, 22, '2023-06-09 11:26:58'),
    (494, 16, 20, '2023-06-09 11:27:00'),
    (495, 11, 19, '2023-06-09 11:27:04'),
    (496, 10, 27, '2023-06-09 11:27:05'),
    (497, 14, 22, '2023-06-09 11:27:07'),
    (498, 12, 30, '2023-06-09 11:27:09'),
    (499, 19, 20, '2023-06-09 11:27:13'),
    (500, 11, 23, '2023-06-09 11:27:14'),
    (501, 10, 30, '2023-06-09 11:27:17'),
    (502, 18, 21, '2023-06-09 11:27:18'),
    (503, 15, 24, '2023-06-09 11:27:19'),
    (504, 17, 23, '2023-06-09 11:27:23'),
    (505, 7, 27, '2023-06-09 11:27:25'),
    (506, 9, 24, '2023-06-09 11:27:29'),
    (507, 6, 24, '2023-06-09 11:27:30'),
    (508, 14, 20, '2023-06-09 11:27:34'),
    (509, 8, 23, '2023-06-09 11:27:35'),
    (510, 9, 27, '2023-06-09 11:27:36'),
    (511, 7, 22, '2023-06-09 11:27:39'),
    (512, 13, 21, '2023-06-09 11:27:40'),
    (513, 9, 30, '2023-06-09 11:27:41'),
    (514, 12, 25, '2023-06-09 11:27:42'),
    (515, 17, 22, '2023-06-09 11:27:45'),
    (516, 6, 20, '2023-06-09 11:27:47'),
    (517, 11, 20, '2023-06-09 11:27:50'),
    (518, 15, 25, '2023-06-09 11:27:53'),
    (519, 15, 27, '2023-06-09 11:27:55'),
    (520, 9, 27, '2023-06-09 11:27:57'),
    (521, 2, 21, '2023-06-09 11:28:01'),
    (522, 17, 24, '2023-06-09 11:28:03'),
    (523, 10, 29, '2023-06-09 11:28:06'),
    (524, 16, 24, '2023-06-09 11:28:09'),
    (525, 5, 28, '2023-06-09 11:28:11'),
    (526, 11, 22, '2023-06-09 11:28:13'),
    (527, 13, 19, '2023-06-09 11:28:16'),
    (528, 13, 30, '2023-06-09 11:28:18'),
    (529, 5, 21, '2023-06-09 11:28:22'),
    (530, 19, 25, '2023-06-09 11:28:24'),
    (531, 1, 27, '2023-06-09 11:28:28'),
    (532, 19, 21, '2023-06-09 11:28:32'),
    (533, 7, 25, '2023-06-09 11:28:35'),
    (534, 2, 25, '2023-06-09 11:28:37'),
    (535, 18, 24, '2023-06-09 11:28:41'),
    (536, 8, 27, '2023-06-09 11:28:42'),
    (537, 9, 30, '2023-06-09 11:28:44'),
    (538, 18, 31, '2023-06-09 11:28:47'),
    (539, 4, 25, '2023-06-09 11:28:49'),
    (540, 5, 27, '2023-06-09 11:28:50'),
    (541, 4, 20, '2023-06-09 11:28:53'),
    (542, 20, 27, '2023-06-09 11:28:55'),
    (543, 7, 20, '2023-06-09 11:28:58'),
    (544, 2, 26, '2023-06-09 11:28:59'),
    (545, 8, 21, '2023-06-09 11:29:01'),
    (546, 10, 25, '2023-06-09 11:29:05'),
    (547, 11, 31, '2023-06-09 11:29:10'),
    (548, 14, 22, '2023-06-09 11:29:11'),
    (549, 5, 31, '2023-06-09 11:29:15'),
    (550, 5, 21, '2023-06-09 11:29:19'),
    (551, 8, 29, '2023-06-09 11:29:22'),
    (552, 12, 30, '2023-06-09 11:29:26'),
    (553, 8, 22, '2023-06-09 11:29:27'),
    (554, 5, 28, '2023-06-09 11:29:29'),
    (555, 4, 23, '2023-06-09 11:29:32'),
    (556, 12, 21, '2023-06-09 11:29:35'),
    (557, 14, 23, '2023-06-09 11:29:36'),
    (558, 10, 26, '2023-06-09 11:29:38'),
    (559, 2, 31, '2023-06-09 11:29:42'),
    (560, 18, 22, '2023-06-09 11:29:44'),
    (561, 3, 22, '2023-06-09 11:29:45'),
    (562, 2, 31, '2023-06-09 11:29:47'),
    (563, 6, 21, '2023-06-09 11:29:51'),
    (564, 5, 30, '2023-06-09 11:29:55'),
    (565, 5, 24, '2023-06-09 11:29:56'),
    (566, 6, 24, '2023-06-09 11:30:00'),
    (567, 14, 25, '2023-06-09 11:30:03'),
    (568, 8, 20, '2023-06-09 11:30:05'),
    (569, 12, 20, '2023-06-09 11:30:08'),
    (570, 5, 20, '2023-06-09 11:30:10'),
    (571, 20, 24, '2023-06-09 11:30:14'),
    (572, 8, 22, '2023-06-09 11:30:16'),
    (573, 2, 24, '2023-06-09 11:30:20'),
    (574, 14, 20, '2023-06-09 11:30:22'),
    (575, 1, 30, '2023-06-09 11:30:25'),
    (576, 13, 31, '2023-06-09 11:30:26'),
    (577, 4, 21, '2023-06-09 11:30:30'),
    (578, 11, 27, '2023-06-09 11:30:31'),
    (579, 19, 20, '2023-06-09 11:30:32'),
    (580, 13, 28, '2023-06-09 11:30:36'),
    (581, 6, 22, '2023-06-09 11:30:38'),
    (582, 10, 23, '2023-06-09 11:30:42'),
    (583, 11, 27, '2023-06-09 11:30:43'),
    (584, 5, 25, '2023-06-09 11:30:46'),
    (585, 2, 20, '2023-06-09 11:30:47'),
    (586, 1, 21, '2023-06-09 11:30:49'),
    (587, 11, 27, '2023-06-09 11:30:51'),
    (588, 11, 23, '2023-06-09 11:30:56'),
    (589, 7, 20, '2023-06-09 11:30:59'),
    (590, 10, 24, '2023-06-09 11:31:03'),
    (591, 7, 20, '2023-06-09 11:31:05'),
    (592, 17, 21, '2023-06-09 11:31:06'),
    (593, 17, 20, '2023-06-09 11:31:08'),
    (594, 5, 21, '2023-06-09 11:31:09'),
    (595, 16, 29, '2023-06-09 11:31:10'),
    (596, 2, 20, '2023-06-09 11:31:14'),
    (597, 4, 25, '2023-06-09 11:31:15'),
    (598, 11, 19, '2023-06-09 11:31:16'),
    (599, 5, 30, '2023-06-09 11:31:20'),
    (600, 4, 26, '2023-06-09 11:31:23'),
    (601, 7, 23, '2023-06-09 11:31:24'),
    (602, 17, 24, '2023-06-09 11:31:25'),
    (603, 2, 25, '2023-06-09 11:31:26'),
    (604, 19, 21, '2023-06-09 11:31:30'),
    (605, 16, 19, '2023-06-09 11:31:32'),
    (606, 17, 26, '2023-06-09 11:31:33'),
    (607, 3, 25, '2023-06-09 11:31:37'),
    (608, 12, 20, '2023-06-09 11:31:39'),
    (609, 17, 29, '2023-06-09 11:31:41'),
    (610, 3, 30, '2023-06-09 11:31:44'),
    (611, 3, 19, '2023-06-09 11:31:47'),
    (612, 13, 29, '2023-06-09 11:31:51'),
    (613, 9, 29, '2023-06-09 11:31:52'),
    (614, 7, 22, '2023-06-09 11:31:56'),
    (615, 11, 28, '2023-06-09 11:31:57'),
    (616, 7, 22, '2023-06-09 11:32:00'),
    (617, 11, 28, '2023-06-09 11:32:04'),
    (618, 7, 29, '2023-06-09 11:32:05'),
    (619, 14, 29, '2023-06-09 11:32:09'),
    (620, 17, 19, '2023-06-09 11:32:10'),
    (621, 17, 22, '2023-06-09 11:32:11'),
    (622, 8, 19, '2023-06-09 11:32:12'),
    (623, 7, 28, '2023-06-09 11:32:14'),
    (624, 1, 26, '2023-06-09 11:32:17'),
    (625, 14, 30, '2023-06-09 11:32:20'),
    (626, 5, 28, '2023-06-09 11:32:22'),
    (627, 7, 31, '2023-06-09 11:32:24'),
    (628, 8, 23, '2023-06-09 11:32:28'),
    (629, 11, 20, '2023-06-09 11:32:29'),
    (630, 13, 19, '2023-06-09 11:32:31'),
    (631, 9, 19, '2023-06-09 11:32:32'),
    (632, 1, 19, '2023-06-09 11:32:35'),
    (633, 12, 31, '2023-06-09 11:32:38'),
    (634, 11, 30, '2023-06-09 11:32:40'),
    (635, 1, 22, '2023-06-09 11:32:42'),
    (636, 4, 20, '2023-06-09 11:32:45'),
    (637, 18, 23, '2023-06-09 11:32:49'),
    (638, 12, 19, '2023-06-09 11:32:51'),
    (639, 19, 25, '2023-06-09 11:32:52'),
    (640, 3, 30, '2023-06-09 11:32:53'),
    (641, 17, 27, '2023-06-09 11:32:54'),
    (642, 4, 31, '2023-06-09 11:32:55'),
    (643, 10, 19, '2023-06-09 11:32:57'),
    (644, 15, 25, '2023-06-09 11:32:58'),
    (645, 17, 31, '2023-06-09 11:33:01'),
    (646, 19, 27, '2023-06-09 11:33:05'),
    (647, 4, 28, '2023-06-09 11:33:09'),
    (648, 16, 23, '2023-06-09 11:33:12'),
    (649, 7, 26, '2023-06-09 11:33:14'),
    (650, 19, 24, '2023-06-09 11:33:17'),
    (651, 4, 27, '2023-06-09 11:33:20'),
    (652, 10, 26, '2023-06-09 11:33:23'),
    (653, 14, 21, '2023-06-09 11:33:26'),
    (654, 16, 31, '2023-06-09 11:33:29'),
    (655, 16, 23, '2023-06-09 11:33:33'),
    (656, 8, 27, '2023-06-09 11:33:34'),
    (657, 9, 20, '2023-06-09 11:33:36'),
    (658, 10, 20, '2023-06-09 11:33:40'),
    (659, 7, 20, '2023-06-09 11:33:41'),
    (660, 13, 31, '2023-06-09 11:33:44'),
    (661, 15, 29, '2023-06-09 11:33:48'),
    (662, 15, 27, '2023-06-09 11:33:51'),
    (663, 3, 24, '2023-06-09 11:33:52'),
    (664, 8, 27, '2023-06-09 11:33:55'),
    (665, 7, 29, '2023-06-09 11:33:58'),
    (666, 7, 26, '2023-06-09 11:33:59'),
    (667, 1, 31, '2023-06-09 11:34:00'),
    (668, 7, 28, '2023-06-09 11:34:03'),
    (669, 7, 20, '2023-06-09 11:34:07'),
    (670, 2, 28, '2023-06-09 11:34:09'),
    (671, 5, 31, '2023-06-09 11:34:10'),
    (672, 13, 26, '2023-06-09 11:34:13'),
    (673, 18, 25, '2023-06-09 11:34:16'),
    (674, 4, 29, '2023-06-09 11:34:20'),
    (675, 18, 27, '2023-06-09 11:34:22'),
    (676, 5, 27, '2023-06-09 11:34:24'),
    (677, 1, 29, '2023-06-09 11:34:25'),
    (678, 14, 19, '2023-06-09 11:34:27'),
    (679, 17, 22, '2023-06-09 11:34:29'),
    (680, 5, 24, '2023-06-09 11:34:32'),
    (681, 4, 23, '2023-06-09 11:34:35'),
    (682, 16, 25, '2023-06-09 11:34:37'),
    (683, 12, 28, '2023-06-09 11:34:39'),
    (684, 5, 22, '2023-06-09 11:34:43'),
    (685, 12, 27, '2023-06-09 11:34:47'),
    (686, 5, 25, '2023-06-09 11:34:51'),
    (687, 1, 22, '2023-06-09 11:34:52'),
    (688, 14, 31, '2023-06-09 11:34:54'),
    (689, 7, 20, '2023-06-09 11:34:56'),
    (690, 20, 30, '2023-06-09 11:35:00'),
    (691, 3, 28, '2023-06-09 11:35:03'),
    (692, 10, 23, '2023-06-09 11:35:04'),
    (693, 9, 31, '2023-06-09 11:35:07'),
    (694, 10, 23, '2023-06-09 11:35:08'),
    (695, 2, 30, '2023-06-09 11:35:12'),
    (696, 11, 24, '2023-06-09 11:35:13'),
    (697, 12, 29, '2023-06-09 11:35:15'),
    (698, 15, 28, '2023-06-09 11:35:17'),
    (699, 19, 28, '2023-06-09 11:35:18'),
    (700, 14, 25, '2023-06-09 11:35:20'),
    (701, 12, 31, '2023-06-09 11:35:21'),
    (702, 4, 30, '2023-06-09 11:35:22'),
    (703, 12, 22, '2023-06-09 11:35:24'),
    (704, 18, 27, '2023-06-09 11:35:26'),
    (705, 8, 21, '2023-06-09 11:35:29'),
    (706, 12, 27, '2023-06-09 11:35:31'),
    (707, 2, 26, '2023-06-09 11:35:33'),
    (708, 18, 26, '2023-06-09 11:35:35'),
    (709, 15, 30, '2023-06-09 11:35:38'),
    (710, 7, 26, '2023-06-09 11:35:40'),
    (711, 9, 27, '2023-06-09 11:35:43'),
    (712, 3, 29, '2023-06-09 11:35:45'),
    (713, 13, 29, '2023-06-09 11:35:47'),
    (714, 12, 20, '2023-06-09 11:35:49'),
    (715, 1, 19, '2023-06-09 11:35:50'),
    (716, 4, 22, '2023-06-09 11:35:51'),
    (717, 16, 19, '2023-06-09 11:35:54'),
    (718, 12, 28, '2023-06-09 11:35:57'),
    (719, 13, 23, '2023-06-09 11:35:58'),
    (720, 17, 23, '2023-06-09 11:35:59'),
    (721, 11, 24, '2023-06-09 11:36:03'),
    (722, 20, 22, '2023-06-09 11:36:05'),
    (723, 20, 23, '2023-06-09 11:36:08'),
    (724, 13, 28, '2023-06-09 11:36:09'),
    (725, 8, 22, '2023-06-09 11:36:10'),
    (726, 12, 20, '2023-06-09 11:36:13'),
    (727, 2, 29, '2023-06-09 11:36:15'),
    (728, 4, 22, '2023-06-09 11:36:18'),
    (729, 20, 25, '2023-06-09 11:36:23'),
    (730, 17, 20, '2023-06-09 11:36:24'),
    (731, 17, 26, '2023-06-09 11:36:27'),
    (732, 3, 27, '2023-06-09 11:36:28'),
    (733, 4, 21, '2023-06-09 11:36:32'),
    (734, 14, 26, '2023-06-09 11:36:33'),
    (735, 17, 21, '2023-06-09 11:36:37'),
    (736, 18, 23, '2023-06-09 11:36:41'),
    (737, 19, 28, '2023-06-09 11:36:45'),
    (738, 19, 26, '2023-06-09 11:36:47'),
    (739, 10, 30, '2023-06-09 11:36:49'),
    (740, 16, 25, '2023-06-09 11:36:53'),
    (741, 1, 22, '2023-06-09 11:36:57'),
    (742, 2, 29, '2023-06-09 11:37:00'),
    (743, 7, 27, '2023-06-09 11:37:03'),
    (744, 19, 27, '2023-06-09 11:37:05'),
    (745, 9, 26, '2023-06-09 11:37:08'),
    (746, 4, 25, '2023-06-09 11:37:11'),
    (747, 1, 27, '2023-06-09 11:37:13'),
    (748, 4, 26, '2023-06-09 11:37:14'),
    (749, 6, 22, '2023-06-09 11:37:17'),
    (750, 4, 22, '2023-06-09 11:37:19'),
    (751, 3, 27, '2023-06-09 11:37:23'),
    (752, 7, 26, '2023-06-09 11:37:27'),
    (753, 13, 23, '2023-06-09 11:37:30'),
    (754, 6, 20, '2023-06-09 11:37:32'),
    (755, 16, 23, '2023-06-09 11:37:33'),
    (756, 20, 29, '2023-06-09 11:37:35'),
    (757, 16, 23, '2023-06-09 11:37:37'),
    (758, 14, 29, '2023-06-09 11:37:38'),
    (759, 5, 19, '2023-06-09 11:37:40'),
    (760, 8, 27, '2023-06-09 11:37:41'),
    (761, 14, 22, '2023-06-09 11:37:44'),
    (762, 19, 26, '2023-06-09 11:37:46'),
    (763, 20, 21, '2023-06-09 11:37:48'),
    (764, 14, 25, '2023-06-09 11:37:51'),
    (765, 2, 22, '2023-06-09 11:37:54'),
    (766, 18, 28, '2023-06-09 11:37:56'),
    (767, 15, 28, '2023-06-09 11:37:57'),
    (768, 19, 26, '2023-06-09 11:37:58'),
    (769, 17, 28, '2023-06-09 11:38:00'),
    (770, 15, 24, '2023-06-09 11:38:03'),
    (771, 3, 19, '2023-06-09 11:38:07'),
    (772, 3, 28, '2023-06-09 11:38:10'),
    (773, 2, 26, '2023-06-09 11:38:13'),
    (774, 20, 31, '2023-06-09 11:38:14'),
    (775, 3, 22, '2023-06-09 11:38:16'),
    (776, 12, 19, '2023-06-09 11:38:19'),
    (777, 20, 30, '2023-06-09 11:38:23'),
    (778, 9, 22, '2023-06-09 11:38:25'),
    (779, 14, 31, '2023-06-09 11:38:27'),
    (780, 19, 23, '2023-06-09 11:38:31'),
    (781, 15, 31, '2023-06-09 11:38:35'),
    (782, 20, 22, '2023-06-09 11:38:37'),
    (783, 6, 23, '2023-06-09 11:38:40'),
    (784, 8, 28, '2023-06-09 11:38:44'),
    (785, 8, 28, '2023-06-09 11:38:46'),
    (786, 12, 22, '2023-06-09 11:38:49'),
    (787, 14, 19, '2023-06-09 11:38:52'),
    (788, 6, 20, '2023-06-09 11:38:56'),
    (789, 18, 26, '2023-06-09 11:38:58'),
    (790, 7, 31, '2023-06-09 11:39:01'),
    (791, 13, 30, '2023-06-09 11:39:02'),
    (792, 2, 31, '2023-06-09 11:39:06'),
    (793, 8, 22, '2023-06-09 11:39:07'),
    (794, 3, 28, '2023-06-09 11:39:08'),
    (795, 18, 24, '2023-06-09 11:39:09'),
    (796, 14, 30, '2023-06-09 11:39:11'),
    (797, 4, 24, '2023-06-09 11:39:14'),
    (798, 3, 28, '2023-06-09 11:39:17'),
    (799, 12, 29, '2023-06-09 11:39:21'),
    (800, 11, 19, '2023-06-09 11:39:22'),
    (801, 18, 27, '2023-06-09 11:39:26'),
    (802, 15, 20, '2023-06-09 11:39:27'),
    (803, 14, 30, '2023-06-09 11:39:28'),
    (804, 6, 31, '2023-06-09 11:39:31'),
    (805, 4, 27, '2023-06-09 11:39:34'),
    (806, 10, 22, '2023-06-09 11:39:35'),
    (807, 8, 25, '2023-06-09 11:39:38'),
    (808, 19, 19, '2023-06-09 11:39:39'),
    (809, 2, 26, '2023-06-09 11:39:43'),
    (810, 12, 19, '2023-06-09 11:39:46'),
    (811, 8, 26, '2023-06-09 11:39:50'),
    (812, 10, 31, '2023-06-09 11:39:53'),
    (813, 6, 19, '2023-06-09 11:39:56'),
    (814, 2, 28, '2023-06-09 11:39:57'),
    (815, 17, 24, '2023-06-09 11:39:59'),
    (816, 17, 25, '2023-06-09 11:40:02'),
    (817, 5, 31, '2023-06-09 11:40:05'),
    (818, 5, 19, '2023-06-09 11:40:09'),
    (819, 20, 25, '2023-06-09 11:40:13'),
    (820, 20, 19, '2023-06-09 11:40:15'),
    (821, 11, 27, '2023-06-09 11:40:19'),
    (822, 18, 23, '2023-06-09 11:40:20'),
    (823, 7, 29, '2023-06-09 11:40:22'),
    (824, 8, 24, '2023-06-09 11:40:23'),
    (825, 20, 31, '2023-06-09 11:40:26'),
    (826, 15, 31, '2023-06-09 11:40:30'),
    (827, 19, 26, '2023-06-09 11:40:31'),
    (828, 8, 31, '2023-06-09 11:40:35'),
    (829, 5, 25, '2023-06-09 11:40:37'),
    (830, 13, 21, '2023-06-09 11:40:40'),
    (831, 2, 29, '2023-06-09 11:40:42'),
    (832, 1, 20, '2023-06-09 11:40:43'),
    (833, 16, 26, '2023-06-09 11:40:46'),
    (834, 3, 31, '2023-06-09 11:40:48'),
    (835, 11, 27, '2023-06-09 11:40:51'),
    (836, 5, 19, '2023-06-09 11:40:52'),
    (837, 13, 26, '2023-06-09 11:40:54'),
    (838, 9, 19, '2023-06-09 11:40:56'),
    (839, 4, 20, '2023-06-09 11:41:00'),
    (840, 18, 21, '2023-06-09 11:41:02'),
    (841, 13, 31, '2023-06-09 11:41:03'),
    (842, 3, 22, '2023-06-09 11:41:04'),
    (843, 13, 20, '2023-06-09 11:41:08'),
    (844, 1, 30, '2023-06-09 11:41:09'),
    (845, 16, 20, '2023-06-09 11:41:11'),
    (846, 9, 25, '2023-06-09 11:41:14'),
    (847, 13, 27, '2023-06-09 11:41:17'),
    (848, 9, 30, '2023-06-09 11:41:21'),
    (849, 16, 25, '2023-06-09 11:41:24'),
    (850, 5, 25, '2023-06-09 11:41:26'),
    (851, 14, 31, '2023-06-09 11:41:27'),
    (852, 7, 26, '2023-06-09 11:41:31'),
    (853, 10, 25, '2023-06-09 11:41:33'),
    (854, 1, 19, '2023-06-09 11:41:36'),
    (855, 3, 28, '2023-06-09 11:41:39'),
    (856, 1, 21, '2023-06-09 11:41:42'),
    (857, 8, 29, '2023-06-09 11:41:43'),
    (858, 13, 28, '2023-06-09 11:41:45'),
    (859, 15, 31, '2023-06-09 11:41:48'),
    (860, 20, 20, '2023-06-09 11:41:50'),
    (861, 13, 20, '2023-06-09 11:41:51'),
    (862, 1, 25, '2023-06-09 11:41:54'),
    (863, 9, 19, '2023-06-09 11:41:56'),
    (864, 13, 26, '2023-06-09 11:41:59'),
    (865, 18, 26, '2023-06-09 11:42:03'),
    (866, 7, 31, '2023-06-09 11:42:06'),
    (867, 15, 19, '2023-06-09 11:42:10'),
    (868, 9, 20, '2023-06-09 11:42:12'),
    (869, 19, 25, '2023-06-09 11:42:14'),
    (870, 8, 19, '2023-06-09 11:42:15'),
    (871, 19, 22, '2023-06-09 11:42:18'),
    (872, 5, 25, '2023-06-09 11:42:20'),
    (873, 2, 24, '2023-06-09 11:42:21'),
    (874, 15, 20, '2023-06-09 11:42:23'),
    (875, 16, 24, '2023-06-09 11:42:26'),
    (876, 11, 26, '2023-06-09 11:42:30'),
    (877, 2, 22, '2023-06-09 11:42:32'),
    (878, 20, 29, '2023-06-09 11:42:33'),
    (879, 18, 29, '2023-06-09 11:42:37'),
    (880, 15, 20, '2023-06-09 11:42:38'),
    (881, 11, 20, '2023-06-09 11:42:42'),
    (882, 11, 21, '2023-06-09 11:42:45'),
    (883, 6, 28, '2023-06-09 11:42:47'),
    (884, 16, 28, '2023-06-09 11:42:49'),
    (885, 17, 22, '2023-06-09 11:42:52'),
    (886, 7, 28, '2023-06-09 11:42:53'),
    (887, 3, 24, '2023-06-09 11:42:55'),
    (888, 1, 27, '2023-06-09 11:42:58'),
    (889, 10, 23, '2023-06-09 11:42:59'),
    (890, 5, 21, '2023-06-09 11:43:00'),
    (891, 3, 28, '2023-06-09 11:43:01'),
    (892, 16, 20, '2023-06-09 11:43:02'),
    (893, 11, 25, '2023-06-09 11:43:03'),
    (894, 5, 22, '2023-06-09 11:43:04'),
    (895, 14, 26, '2023-06-09 11:43:05'),
    (896, 20, 27, '2023-06-09 11:43:08'),
    (897, 3, 22, '2023-06-09 11:43:09'),
    (898, 5, 29, '2023-06-09 11:43:11'),
    (899, 14, 31, '2023-06-09 11:43:15'),
    (900, 16, 21, '2023-06-09 11:43:19'),
    (901, 11, 31, '2023-06-09 11:43:20'),
    (902, 16, 23, '2023-06-09 11:43:23'),
    (903, 16, 30, '2023-06-09 11:43:25'),
    (904, 10, 28, '2023-06-09 11:43:28'),
    (905, 11, 21, '2023-06-09 11:43:31'),
    (906, 14, 26, '2023-06-09 11:43:35'),
    (907, 10, 27, '2023-06-09 11:43:38'),
    (908, 3, 23, '2023-06-09 11:43:42'),
    (909, 13, 19, '2023-06-09 11:43:46'),
    (910, 11, 31, '2023-06-09 11:43:47'),
    (911, 13, 31, '2023-06-09 11:43:48'),
    (912, 17, 23, '2023-06-09 11:43:50'),
    (913, 17, 24, '2023-06-09 11:43:51'),
    (914, 4, 31, '2023-06-09 11:43:53'),
    (915, 7, 27, '2023-06-09 11:43:57'),
    (916, 19, 26, '2023-06-09 11:43:58'),
    (917, 18, 23, '2023-06-09 11:44:01'),
    (918, 16, 25, '2023-06-09 11:44:04'),
    (919, 6, 25, '2023-06-09 11:44:05'),
    (920, 19, 31, '2023-06-09 11:44:08'),
    (921, 20, 25, '2023-06-09 11:44:09'),
    (922, 14, 25, '2023-06-09 11:44:12'),
    (923, 17, 29, '2023-06-09 11:44:16'),
    (924, 19, 20, '2023-06-09 11:44:20'),
    (925, 15, 24, '2023-06-09 11:44:21'),
    (926, 8, 22, '2023-06-09 11:44:25'),
    (927, 13, 29, '2023-06-09 11:44:27'),
    (928, 5, 29, '2023-06-09 11:44:29'),
    (929, 2, 19, '2023-06-09 11:44:34'),
    (930, 5, 26, '2023-06-09 11:44:38'),
    (931, 20, 25, '2023-06-09 11:44:40'),
    (932, 3, 19, '2023-06-09 11:44:43'),
    (933, 14, 28, '2023-06-09 11:44:45'),
    (934, 14, 29, '2023-06-09 11:44:46'),
    (935, 1, 20, '2023-06-09 11:44:49'),
    (936, 1, 27, '2023-06-09 11:44:51'),
    (937, 10, 27, '2023-06-09 11:44:55'),
    (938, 18, 29, '2023-06-09 11:44:56'),
    (939, 1, 28, '2023-06-09 11:44:57'),
    (940, 16, 22, '2023-06-09 11:44:59'),
    (941, 7, 22, '2023-06-09 11:45:02'),
    (942, 11, 30, '2023-06-09 11:45:06'),
    (943, 18, 31, '2023-06-09 11:45:07'),
    (944, 12, 22, '2023-06-09 11:45:11'),
    (945, 13, 29, '2023-06-09 11:45:15'),
    (946, 17, 26, '2023-06-09 11:45:19'),
    (947, 7, 26, '2023-06-09 11:45:22'),
    (948, 1, 19, '2023-06-09 11:45:24'),
    (949, 4, 31, '2023-06-09 11:45:27'),
    (950, 5, 26, '2023-06-09 11:45:29'),
    (951, 14, 26, '2023-06-09 11:45:33'),
    (952, 17, 24, '2023-06-09 11:45:34'),
    (953, 6, 21, '2023-06-09 11:45:38'),
    (954, 5, 21, '2023-06-09 11:45:40'),
    (955, 9, 19, '2023-06-09 11:45:44'),
    (956, 12, 26, '2023-06-09 11:45:47'),
    (957, 5, 30, '2023-06-09 11:45:48'),
    (958, 3, 26, '2023-06-09 11:45:52'),
    (959, 12, 21, '2023-06-09 11:45:55'),
    (960, 13, 23, '2023-06-09 11:45:57'),
    (961, 2, 22, '2023-06-09 11:46:01'),
    (962, 10, 31, '2023-06-09 11:46:05'),
    (963, 14, 24, '2023-06-09 11:46:06'),
    (964, 15, 24, '2023-06-09 11:46:08'),
    (965, 18, 19, '2023-06-09 11:46:09'),
    (966, 16, 24, '2023-06-09 11:46:12'),
    (967, 4, 22, '2023-06-09 11:46:16'),
    (968, 11, 25, '2023-06-09 11:46:20'),
    (969, 3, 24, '2023-06-09 11:46:22'),
    (970, 20, 30, '2023-06-09 11:46:24'),
    (971, 7, 24, '2023-06-09 11:46:27'),
    (972, 14, 26, '2023-06-09 11:46:31'),
    (973, 10, 22, '2023-06-09 11:46:32'),
    (974, 8, 30, '2023-06-09 11:46:34'),
    (975, 5, 30, '2023-06-09 11:46:36'),
    (976, 4, 26, '2023-06-09 11:46:39'),
    (977, 12, 19, '2023-06-09 11:46:40'),
    (978, 9, 23, '2023-06-09 11:46:41'),
    (979, 13, 22, '2023-06-09 11:46:43'),
    (980, 12, 29, '2023-06-09 11:46:45'),
    (981, 12, 22, '2023-06-09 11:46:47'),
    (982, 4, 30, '2023-06-09 11:46:51'),
    (983, 11, 19, '2023-06-09 11:46:54'),
    (984, 9, 24, '2023-06-09 11:46:56'),
    (985, 10, 20, '2023-06-09 11:46:59'),
    (986, 10, 19, '2023-06-09 11:47:01'),
    (987, 16, 25, '2023-06-09 11:47:03'),
    (988, 17, 25, '2023-06-09 11:47:05'),
    (989, 10, 26, '2023-06-09 11:47:09'),
    (990, 15, 25, '2023-06-09 11:47:12'),
    (991, 20, 24, '2023-06-09 11:47:16'),
    (992, 10, 25, '2023-06-09 11:47:20'),
    (993, 10, 31, '2023-06-09 11:47:24'),
    (994, 19, 19, '2023-06-09 11:47:25'),
    (995, 8, 29, '2023-06-09 11:47:28'),
    (996, 19, 27, '2023-06-09 11:47:32'),
    (997, 15, 31, '2023-06-09 11:47:35'),
    (998, 10, 24, '2023-06-09 11:47:39'),
    (999, 19, 20, '2023-06-09 11:47:43'),
    (1000, 4, 25, '2023-06-09 11:47:45');

15
16

4. Create a Session Cluster

1.  Navigate to the Real-Time Computing Console, locate the Flink you created, and click Console under the Action column on the right side.

17

2.  Click on Session Cluster in the left-hand navigation bar, and then click Create Session Cluster

18

3.  On the Create Session Cluster page, configure the parameters according to the following instructions, leave parameters not mentioned at their default values, and click Create Session Cluster.

Parameter Description:

Configuration Item Description Tutorial Configuration
Name The name of the Session Cluster Tutorial Configuration: test
State Sets the desired operational state of the current cluster:
STOPPED: The cluster remains stopped after configuration is complete, and it will also stop all currently running jobs.
RUNNING: The cluster remains running after the configuration is completed.
RUNNING
Set as SQL Previews Cluster Set this session cluster as the resource cluster for SQL Preview queries. Enable

19

4.  On the Session Cluster page, wait for the status of the Session Cluster you created to change from starting to running before proceeding to the next steps.

20

5. Create Flink Job

1.  In the left navigation pane, click on SQL Editor.

21

2.  On the SQL Editor, click on New.

22

3.  Choose the type of SQL Scripts and Create a Temporary Table, then click Next

23

4.  In the New File dialogue box, enter the file name as test and choose the vvr-8.0.6-flink-1.17 version Engine. Leave the other options at their default settings and click Create.

24

5.  Use the MySQL CDC connector to capture real-time changes in the source_table. Then, click on ”Validate“ to confirm whether there are any syntax errors in the job's Flink SQL statement.

Note: You need to replace the hostname parameter in the statement with the internal address of your RDS MySQL Serverless database, replace the username and password parameters with the database account credentials you created, and substitute the database-name parameter with the name of the database you have established. The expression 'connector' = 'mysql-cdc' is designated using the MySQL CDC (Change Data Capture) connector for capturing data changes.

You can click the Validate button in the top toolbar to verify the absence of syntax errors in your Flink SQL job statement.

CREATE TEMPORARY TABLE source_table(
    id INT NOT NULL PRIMARY KEY NOT ENFORCED,
    record_time TIMESTAMP_LTZ(3),
    good_id INT,
    amount INT,
    WATERMARK FOR record_time AS record_time-INTERVAL '5' SECOND
)WITH(
    'connector' = 'mysql-cdc',
    'hostname' = '******************.mysql.rds.aliyuncs.com',
    'port' = '3306',
    'username' = '***********',
    'password' = '***********',
    'database-name' = '***********',
    'table-name' = 'source_table'
);

25

6.  To test whether the source table data has been successfully captured, write a line of the statement "SELECT * FROM source_table;", then click on Debug in the toolbar. Subsequently, insert some data into the source_table. If the corresponding data rows are printed in the console, it indicates a successful capture, as shown in the figure below

26

7.  Next, we aim to group and compute the original data based on time windows. We use the TUMBLE window functions with GROUP BY to classify order data within a 15-second window by product ID, and use SUM to calculate their total sales.

In the Flink job editing tab, enter the following code. Ensuring there is data in the source table, execute the Flink job again and observe the output results in the console.

SELECT
  good_id,
  tumble_start(
    record_time, interval '15' seconds
 ) AS record_timestamp,
  sum(amount) AS total_amount
FROM
  source_table
GROUP BY
  tumble(
    record_time, interval '15' seconds
  ),
 good_id;

27

8.  In this business scenario, the purchase of product information is recorded using good_id, while product IDs are mapped to readable product names, the price of each product, and other information stored in another Dimension Table. We can also use Flink SQL to join with the Dimension Table by writing the following statement in the Flink job.

CREATE TEMPORARY TABLE dimension_table (
    good_id INT NOT NULL PRIMARY KEY NOT ENFORCED,
    good_name VARCHAR(256),
    good_price INT
)WITH(
    'connector' = 'mysql',
    'hostname' = '******************.mysql.rds.aliyuncs.com',
    'port' = '3306',
    'username' = '******************',
    'password' = '*********',
    'database-name' = '*********',
    'table-name' = 'dimension_table'
);

Here, based on the sales volume per product every 15 seconds information calculated in the previous step, we aim to compute the sales revenue for each product. Since the product name and price data are stored in another Dimension Table called dimension_table, we need to perform a JOIN operation between the result view and dimension_table. We then multiply the product sales volume and product price to compute the "product sales revenue" and extract the readable product name information for the result table.

SELECT
  record_timestamp,
  good_name,
  total_amount * good_price AS revenue
FROM
  (
    SELECT
     good_id,
     tumble_start(
        record_time, interval '15' seconds
     ) AS record_timestamp,
      sum(amount) AS total_amount
    FROM
      source_table
    GROUP BY
      tumble(
        record_time,interval '15'seconds
        ),
      good_id
  )AS tumbled_table
  LEFT JOIN dimension_table ON tumbled_table.good_id = dimension_table.good_id;

The SQL statement lines from 7 to 20 are identical to those in the previous step.

Execute the above statement and observe the statistical data in the console.

28
29

9.  Finally, we aim to write these real-time statistical data back to the database, and Flink SQL can achieve this quite simply. First, we need to create a Flink temporary table for connecting to the sink table, as shown below:

CREATE TEMPORARY TABLE sink_table (
    record_timestamp TIMESTAMP(3) NOT NULL PRIMARY KEY NOT ENFORCED,
    good_name VARCHAR(128),
    sell_amount INT
) WITH (
  'connector' = 'jdbc',
  'url' = 'jdbc:mysql://******************.mysql.rds.aliyuncs.com:3306/NAME OF THE DATABAE YOU CREATED',
  'table-name' = 'sink_table',
  'username' = '***********',
  'password' = '***********',
  'scan.auto-commit' = 'true'
);

Then, simply INSERT the output result of the above SELECT statement into this table:

INSERT INTO sink_table 
SELECT 
  record_timestamp, 
  good_name, 
  total_amount * good_price AS revenue 
FROM 
  (
    SELECT 
      good_id, 
      tumble_start(
        record_time, interval '15' seconds
      ) AS record_timestamp, 
      sum(amount) AS total_amount 
    FROM 
      source_table 
    GROUP BY 
      tumble (
        record_time, interval '15' seconds
      ), 
      good_id
  ) AS tumbled_table 
  LEFT JOIN dimension_table ON tumbled_table.good_id = dimension_table.good_id;

30
31
32
33

10.  Now, you can deploy and execute the Flink SQL job we have written by clicking Deploy. You can use database client software and similar tools to observe whether the correct data has been written into the sink table.

34
35

When debugging using the execute function in the Alibaba Cloud' Realtime Computie console, no data will be written to downstream. Therefore, to test writing into the sink table using the SQL Connector, you must use the deploy feature.

36

You can also enter the Flink UI console to observe the stream data processing graph. In this simple example, the first step involves capturing source table data and performing window aggregation; following this, a JOIN operation with a dimension table is conducted to obtain computational results; finally, the processed data is stored into the sink table.

6. Lab Attachments

That concludes all the steps of this lab. The complete Flink SQL statement is as follows:

-- Source Table;
CREATE TEMPORARY TABLE source_table (
    id INT NOT NULL PRIMARY KEY NOT ENFORCED,
    record_time TIMESTAMP_LTZ(3),
    good_id INT,
    amount INT,
    WATERMARK FOR record_time AS record_time - INTERVAL '5' SECOND
) WITH (
    'connector' = 'mysql-cdc',
    'hostname' = '******************.mysql.rds.aliyuncs.com',
    'port' = '3306',
    'username' = '***********',
    'password' = '***********',
    'database-name' = '***********',
    'table-name' = 'source_table'
);

-- Dimension Table;
CREATE TEMPORARY TABLE dimension_table (
    good_id INT NOT NULL PRIMARY KEY NOT ENFORCED,
    good_name VARCHAR(256),
    good_price INT
) WITH (
    'connector' = 'mysql',
    'hostname' = '******************.mysql.rds.aliyuncs.com',
    'port' = '3306',
    'username' = '***********',
    'password' = '***********',
    'database-name' = '***********',
    'table-name' = 'dimension_table'
);

-- Sink Table;
CREATE TEMPORARY TABLE sink_table (
    record_timestamp TIMESTAMP(3) NOT NULL PRIMARY KEY NOT ENFORCED,
    good_name VARCHAR(128),
    sell_amount INT
) WITH (
  'connector' = 'jdbc',
  'url' = 'jdbc:mysql://******************.mysql.rds.aliyuncs.com:3306/***********',
  'table-name' = 'sink_table',
  'username' = '***********',
  'password' = '***********',
  'scan.auto-commit' = 'true'
);

-- Job script;
INSERT INTO sink_table 
SELECT 
  record_timestamp, 
  good_name, 
  total_amount * good_price AS revenue 
FROM 
  (
    SELECT 
      good_id, 
      tumble_start(
        record_time, interval '15' seconds
      ) AS record_timestamp, 
      sum(amount) AS total_amount 
    FROM 
      source_table 
    GROUP BY 
      tumble (
        record_time, interval '15' seconds
      ), 
      good_id
  ) AS tumbled_table 
  LEFT JOIN dimension_table ON tumbled_table.good_id = dimension_table.good_id;

In order to populate sample data into the cloud database RDS, you can execute the following SQL statement in the database console/backend:

-- Source Table;
CREATE TEMPORARY TABLE source_table (
    id INT NOT NULL PRIMARY KEY NOT ENFORCED,
    record_time TIMESTAMP_LTZ(3),
    good_id INT,
    amount INT,
    WATERMARK FOR record_time AS record_time - INTERVAL '5' SECOND
) WITH (
    'connector' = 'mysql-cdc',
    'hostname' = '******************.mysql.rds.aliyuncs.com',
    'port' = '3306',
    'username' = '***********',
    'password' = '***********',
    'database-name' = '***********',
    'table-name' = 'source_table'
);

-- Dimension Table;
CREATE TEMPORARY TABLE dimension_table (
    good_id INT NOT NULL PRIMARY KEY NOT ENFORCED,
    good_name VARCHAR(256),
    good_price INT
) WITH (
    'connector' = 'mysql',
    'hostname' = '******************.mysql.rds.aliyuncs.com',
    'port' = '3306',
    'username' = '***********',
    'password' = '***********',
    'database-name' = '***********',
    'table-name' = 'dimension_table'
);

-- Sink Table;
CREATE TEMPORARY TABLE sink_table (
    record_timestamp TIMESTAMP(3) NOT NULL PRIMARY KEY NOT ENFORCED,
    good_name VARCHAR(128),
    sell_amount INT
) WITH (
  'connector' = 'jdbc',
  'url' = 'jdbc:mysql://******************.mysql.rds.aliyuncs.com:3306/***********',
  'table-name' = 'sink_table',
  'username' = '***********',
  'password' = '***********',
  'scan.auto-commit' = 'true'
);

-- Job script;
INSERT INTO sink_table 
SELECT 
  record_timestamp, 
  good_name, 
  total_amount * good_price AS revenue 
FROM 
  (
    SELECT 
      good_id, 
      tumble_start(
        record_time, interval '15' seconds
      ) AS record_timestamp, 
      sum(amount) AS total_amount 
    FROM 
      source_table 
    GROUP BY 
      tumble (
        record_time, interval '15' seconds
      ), 
      good_id
  ) AS tumbled_table 
  LEFT JOIN dimension_table ON tumbled_table.good_id = dimension_table.good_id;

Alternatively, you can also execute the following Python script to populate the database with data in real-time (requires installing the mysql-connector dependency):

import mysql.connector
from time import sleep
from random import randint
from datetime import datetime

mydb = mysql.connector.connect(
    host='******************.mysql.rds.aliyuncs.com',
    port=3306,
    user='***********',
    passwd='***********',
    database='***********'
)


while True:    
    cur = mydb.cursor()
    cur.execute("INSERT INTO source_table (good_id, amount, record_time) VALUES (%d, %d, '%s')" % ( randint(1, 20), randint(19, 31), datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
    mydb.commit()
    cur.close()
    sleep(randint(1, 4))

7. Cleanup and Follow-Up Tasks

Through a basic example of real-time data analysis, you have completed the activation of Alibaba Cloud Realtime Compute for Apache Flink, executed SQL query statements, and conducted data analysis visualization, swiftly experiencing the Realtime Compute for Apache Flink.

1. Clean up

Note: If you no longer require continued use, please promptly clean up related resources before the end of the trial. If resources are not cleaned up in a timely manner, the associated Flink workspaces will be billed normally under the Pay-As-You-Go model, and charges for other involved product services will also be incurred as usual. After completing the tutorial, you may handle the resources according to the following scenarios:

1.1 Realtime Compute for Apache Flink Resource Cleanup

Log in to the Real-Time Compute console, click on More under the operation column of the target workspace, and then click on Release Resources. Confirm by clicking OK. The Application Real-Time Monitoring Service (ARMS) and, if you opted for them upon activation, will be released along with the Real-Time Compute for Apache Flink service.

1.2 Object Storage Service (OSS) Resource Cleanup

Delete the Object Storage Service bucket. For details, please refer to Delete buckets.

1.3 Virtual Private Cloud(VPC) Resource Cleanup

Delete the Virtual Private Cloud. For more information, please refer to Create and manage a VPC.

1.4 RDS MySQL Serverless Resource Cleanup

After finished the lab, you can manually release it. For specific operations, please refer to Releasing an Instance. If the instance is not released, it will be billed at the standard rate after the trial period ends. Please refer to the Serverless Pricing for the billing standard.

2. Next Steps

If you need to deploy a particular job to a production environment (please refrain from using Session Clusters in a formal production environment), you will need to navigate to the job development page, click on Deploy. In the confirmation dialog that appears, click on Confirm. Then, on the job operations page, click Start. For specific operations, please refer to Develop an SQL draft and Start a deployment.


>> Get hands-on experience with this tutorial in a lab environment.

0 1 0
Share on

Alibaba Cloud Community

1,060 posts | 259 followers

You may also like

Comments

Alibaba Cloud Community

1,060 posts | 259 followers

Related Products