This topic introduces how to generate, view, and download mock data.
Background information
OceanBase Developer Center (ODC) provides the data mocking feature. This feature can generate a large amount of data based on field types in tables for database performance testing or feature verification.
Generate mock data
You can generate mock data based on tables in the database.
| Parameter | Example |
|---|---|
| Project Name | odc_4.2.0 |
| Database Name | odc_test |
| Table Name | employee |
In the SQL development window, choose Ticket > Mock Data > Create Mock Data Task.
On the Create Mock Data Task page, specify the following information.
Parameter Description Database Select the odc_testdatabase.Table Select the employeetable in the currentodc_testdatabase to generate mocking data for the table.Mock Data Volume Specify the desired number of data rows to be generated. The default value is 1,000. The system can generate up to 1,000,000 rows of data. You can set the value to an integer between 1 and 1,000,000. Batch Size Specify the number of rows generated that trigger a COMMIToperation. The default value is 200. That is, a commit operation is performed every time when 200 rows are generated. The maximum value supported is 500. You can set the value to an integer between 1 and 500.Empty Table Before Inserting Mock Data Specify whether or not to empty the table before inserting mock data. Data Conflict Handling Mode Specify the data conflict handling method. ODC supports the following methods: - Ignore: This option is selected by default. The data conflicting with existing data is not inserted.
- Overwrite: If a data conflict occurs, the original data is deleted, and the new data is inserted.
- Terminate: If a data conflict occurs, the data mocking task is terminated.
Rule Settings The data generation rules.
In the Rule and Rule Details columns, specify the data generation rules for the target fields in the selected table. The Rule column provides built-in rules based on the field type. The Rule Details column displays the detailed information for the rule that you selected. You can click the edit icon to edit the information.Task Settings Select Execute Immediately or Timed Execution. Click Submit to generate a data mocking task.
After the task is generated, the Task Center tab appears. In the Task Center panel, you can view the task approval result and task information.
View mock data
Task information
In the mock data list on the Task Center tab, click View in the Actions column. The Task Details panel appears. In the upper-right corner of the panel, click the Task Information tab to view the basic information and mock data settings of the task.
Parameter Description Basic task information Displays the basic information about the task in the following fields: Task ID, Connection Name, Database, Task Type, Execution Method, Created By, and Created At. Data mocking settings Displays the settings specified when the data mocking task was created in the following fields: Table, Mock Data Volume, Batch Size, Empty Table Before Inserting Mock Data, Data Conflict Handling Mode, Actual Insertion Records, Conflict Records, Ignore Insertion, Clear Records, and Rule Settings. In the lower-right corner of the task information panel, you can click Initiate Again or Download to restart the task or download the exported file to your local computer.
Task logs
In the mock data list on the Task Center tab, click View in the Actions column of the row where the target task is located. The Task Details panel appears. Click the Task Logs tab in the panel to view the alert logs and all logs of the task.
| Parameter | Description |
|---|---|
| All Logs | Displays the complete information of all task logs, including INFO, ERROR, and WARN logs. |
| Alert Logs | Displays the ERROR and WARN logs of the task. When a task fails, you can view the error message in the alert logs. |
In addition, the toolbar provides the following buttons:
| Button | Note |
|---|---|
| Find | Click this button to search for logs. |
| Download | Click this button to download logs. |
| Copy | Click this button to copy logs. |
Download mock data
In the mock data list on the Task Center tab, click Download in the Actions column to download the created mock data to a local disk. You can view the data structure file in your local disk.