DBeaver Documentation

DOWNLOAD pdf

Mock Data Generation in DBeaver

Note: This feature is available in Enterprise, Ultimate and Team editions only.

Overview

The Mock Data generator in DBeaver automates the process of creating test data, making it much faster and more efficient than entering data manually. It is built to support the creation of large amounts of data, making it suitable for projects that require generating thousands of data entities.

Important: Mock Data is intended for generating test data in development environments and should not be used in production. Always ensure you have a backup of your database before initiating data generation.

Key features

  • Support across RDBMS: Compatible with all RDBMS supported by DBeaver including DB2, MS SQL Server, MySQL, Oracle, PostgreSQL, SQLite, and others.
  • Schema compliance: Automatically generates data that adheres to the database schema, supporting all base data types and constraints (PK, FK, unique, etc.).
  • Extensive data generators: Offers more than 20 data generators for various data types with customizable parameters.

Generating mock data

  1. To start generating mock data, you can initiate the Mock Data Wizard using one of the following methods, depending on your current context:

    1. Database Navigator: Right-click on a table, then select Tools -> Generate Mock Data.
    2. Data Editor: Access the context menu and choose Generate Mock Data.
    3. Metadata Editor: Right-click on a table and select Tools -> Generate Mock Data.

Tip: It is possible to select multiple tables and generate mock data for all of them simultaneously.

  1. After launching the Mock Data Wizard:

    1. A configuration window appears where you can set the initial settings:

      Option Description
      Remove old data Deletes any existing data before generating new data.
      Row count Specify the number of rows to generate.
      Batch size Define the size of batches for data generation.

    2. After configuring the initial settings, select a column in the table. Use the dropdown menu to choose the desired generator for each column according to your needs. Refer to the specific parameters section for detailed configuration options for each generator type.

    3. In the right column, configure the specific settings for the selected generator. These settings vary depending on the generator type.

      The following parameters are common across all types of data generators and can be configured to tailor the mock data:

      Parameter Description
      % of NULLs Specifies the percentage of NULL values to generate for the column.
      Random Seed Sets a seed for the data generation process to ensure reproducibility. Leave this field empty for a random seed.
  2. Click the Proceed button to start the generation process.

Data generators

Mock data generators provide configurable settings to tailor the generated data according to different requirements and data types.

Boolean

Generator Description
Random Generates boolean values randomly.
Sequence Produces boolean values in a specified sequence.
Constant Generates boolean values based on specific constants.

Date

Generator Description
Random Generates dates randomly within a specified range.
Sequence Produces dates in a sequence, with options for step and direction.
Constant Generates dates based on specific constants.

Numeric

Generator Description
Random Generates random numbers within a range.
Sequence Produces numbers sequentially with specified steps and direction.
Constant Generates numbers based on specific constants.
Price Generates realistic price values within a specified range.
Coordinate Produces geographical coordinates.

String

Generator Description
Text Generates strings based on a given template.
Random Text Generates random text.
UUID Generates unique identifiers.
Regex based Produces strings that match a specified regular expression pattern.
Email Generates email addresses with options for gender, surname inclusion, and a numeric suffix.
Name Produces personal names, configurable by gender and whether to include a surname.
Templates
Directive Description
Address Generates US postal addresses.
City Generates names of major world cities.
Country Generates country names.
Domain Generates top internet domain names.
Email Generates email addresses based on gender and surname inclusion.
Name Generates personal names based on gender and surname settings.
Random Generates a random integer between specified limits.
Regex Generates values matching a specified regex pattern.
Sequence Generates a sequence of integers starting from a specific value with defined steps.

Regex

Generator Description
Credit Card Generates strings that match common credit card number patterns.
Email Produces email addresses in a random format.
Gender Generates strings representing gender.
Hex Color Generates strings that represent hexadecimal color codes.
IP4 Produces strings formatted as IPv4 addresses.
IP6 Generates strings formatted as IPv6 addresses.
Phone Number Creates strings that resemble phone numbers in various formats.
Postal Code Generates strings that match postal code formats for different countries.
String Price Produces strings representing prices with currency symbols.

Special data

Data Type Description
NULL Generates NULL values for database columns as specified.
FK (Foreign Key) Pulls data from referenced tables according to constraints.