Generating Data for Empty Database

This topic describes how to populate an empty database using dbForge Studio.

The following use case demonstrates the use of dbForge Studio to quickly populate an empty database with meaningful test data. For this purpose, the following database called salesdb was created. The screenshot below graphically demonstrates the structure of the database, including tables, columns, connections, data types, foreign keys, etc.

To Generate test data:

  1. On the Tools menu, click New Data Generation.
  2. Specify the connection and select the salesdb database. Click Next.
  3. The Options page will appear. On the Options page, set required options and click Open. The following window opens.

The window allows you to:

  • select columns to be populated (in the Tables and columns to populate pane);
  • select a generator you want to use for each separate column (in the Generation settings pane);
  • customize parameter settings for each generator (in the Generation settings pane).

To populate all the columns, select the checkbox next to the salesdb. Alternatively, you can specify the tables that you want to populate by selecting the check boxes next to the table names.

In addition, dbForge Studio provides the Preview window, that shows a table with the generated data.

Selecting generators for individual columns

For a column you select, dbForge Studio automatically assigns a generator based on the column and table characteristics: name, data type, etc. You may select a different generator for the column and customize the parameters of this generator in the settings pane.

Below are several examples of how generators are assigned to specific columns, as well as how they may be customized.

FirstName column

Select the FirstName column. The First Name (any gender) generator is automatically assigned to this column. The generator provides realistic male first names. In the text box, you can see a predefined regexp template to generate names. The template may be customized by inserting various snippets, counters, files, and columns.

MiddleInitial column

Select the MiddleInitial column. The Middle Name generator is automatically assigned to this column. The generator provides a wide range of middle names including both the full names and initials. The values to be generated may be customized using regular expressions. For example, if you want only one-character initials to be generated, specify the [A-Z] regular expression in the text box of the settings pane. The values may also be adjusted by inserting predefined regexp snippets, counters, files, and columns.

Twitter column

Select the Twitter column. The Twitter generator is automatically assigned to this column. The generator yields a great number of twitter user names. The user names will be generated with an at sign (@) at the beginning of the names. To customize the names (e.g. include uppercase letters, numbers, underscore characters, etc), use regular expressions. The names may be further adjusted by inserting predefined regexp snippets, counters, files, and columns.

SSN column

Select the SSN column. The US Social Security Number (SSN) generator is automatically assigned to this column. The generator will populate the column with random numbers. You can customize the numbers in the text box using various regular expressions or by inserting regexp snippets, counters, files, and columns.

For example, with the help of regexp snippets, you can add or generate lower case and uppercase letters, hexadecimal characters, digits without a zero. You can also specify groups, alternatives, repeats, etc. of the generated values.

With the help of the counter, you can get a sequence of digits in increment/decrement order, sequence of characters in increment/decrement order, and hexadecimal characters in increment/decrement order.

ShippingMethod column

Select the ShippingMethod column. The Shipping Method generator is automatically assigned to this column. The generator provides a wide range of realworld shipping methods, such as USPS Express Mail, FedEx, DHL, Airmail Priority, etc. The list of all shipping methods is visible in the text box of the settings pane. You can customize this list manually or by adding regexp snippets, counters, columns, files from the drop-down lists below the text box.

Preview window

While selecting tables and customizing generators, the Preview window displays data to be generated in real-time.