Background information
OceanBase Developer Center (ODC) provides the data mocking feature for you to quickly generate data based on the field types of an existing table in scenarios that require a large amount of mock data, such as database performance testing and feature verification.
This topic describes how to generate mock data for a table in a ticket.
Note
The data in this topic is for reference only. You can replace the data with the actual data.
Considerations
At most 100 million rows can be mocked at a time.
Data mocking is not supported for a table with
CHECKconstraints.Data mocking is not supported for RANGE- or LIST-partitioned tables.
Data mocking is not supported for a table that is encoded by using ZHSGB2312.
Create a data mocking task
In the SQL window, choose Tickets > Mock Data > Create New.
Configure the following parameters and click Submit.
ParameterDescriptionDatabase Select the target database . Table Select a table in the database to generate mock data based on this table. Mock Data Volume Specify the number of rows to be generated. The default value is 1000. At most 100 million rows can be generated. You can enter a value ranging from 1 to 100,000,000.Batch Size Specify the number of rows that triggers a commit by using the COMMITcommand. By default, a commit is performed each time when 200 rows are generated. The maximum value is500. You can enter an integer ranging from 1 to 500.Truncate Table Before Inserting Mock Data Specify whether to clear the original data before inserting mock data into the table. Data Conflict Handling Mode Select the handling method when the inserted data conflicts with the original data in the table. Valid values: - 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 Set the data generation rules.
In the Rule and Rule Details columns, set the mock data generation rules for the fields in the selected table. Some built-in rules are provided in the Rule column based on the field type. The Rule Details column displays the details about the selected rule. You can click the Edit icon to edit the details.Task Settings Select Execute Now or Scheduled Execution. After the task is generated, you can view the task information in the Tickets > Mock Data list.
View a data mocking task
Go to Tickets > Mock Data, and click the name of the target task in the simulated data task list to view the task details. You can also click the ··· icon in the Actions column to perform more operations on the task.
- Execute: When the execution mode is manual, click this option to execute the task.
- Terminate: When the execution mode is periodic or scheduled, click this option to terminate the task.
- Edit: When the task status is disabled, click this option to edit the task.
- Delete: When the task status is completed or terminated, click this option to delete the task.
- View: View the task details.
- Clone: Copy the task execution content to quickly generate a new task with the same configuration.
- Share: Quickly copy the task access address.
- Download: Download the generated mock data to the local disk. You can view the exported data structure file from the local disk.
In the task details panel that appears, the Basic Information tab is displayed by default. You can view the task type, database, variable configuration, and execution mode.
Note
You can configure whether to allow queries and downloads of query results in the system settings. For more information, see System settings.
Click the Workflow tab to view the task status, approval status, execution status, and execution result.
Click the Logs tab to view all logs and alert logs of the task.
ItemDescriptionAll Logs All logs display the INFO, ERROR, and WARN logs of the task. You can click the Find, Download, and Copy buttons to find, download, or copy all logs. Alert Logs Alert logs display the ERROR and WARN logs of the task. When the task fails, you can view the error information in the alert logs. You can click the Find, Download, and Copy buttons to find, download, or copy alert logs.
