With dbForge Data Generator for SQL Server, it is possible to create a new generator if the generators provided don’t suit your needs and the customization doesn’t help.
You can create a new generator as an XML file. The location of Generator files is C:\Users\Public\Documents\Devart\dbForge Data Generator for SQL Server\Data Generators
You can create a new generator either from scratch or using a template. For detailed instructions on how to generate related data elements, refer to our blog post.
dbForge Data Generator for SQL Server is supplied with a wide collection of generator templates that can be easily used for creation of your own data generators.
To create a custom generator using a template:
1. Open the Templates folder -
C:\Users\Public\Public Documents\Devart\dbForge Data Generator for SQL Server\Data Generators\Templates
.
Note
The default location to store custom data generation settings is
C:\Users\Public\Public Documents\Devart\dbForge Data Generator for SQL Server\Data Generators\Templates
, and while it is not possible to change it, you can specify a custom location of .dgen files by modifying the registry at:
Computer\HKEY_CURRENT_USER\Software\Devart\dbForge Data Generator for SQL Server\Folders
.
2. Open a required template in the editor.
3. Modify the selected generator according to your needs. For more information, see XML tags explanation and Mapping rules.
4. Save the new generator file into the Data Generators folder.
5. Start (or restart) Data Generator.
1. Open the Data Generators folder in
C:\Users\Public\Public Documents\Devart\dbForge Data Generator for SQL Server\Data Generators
.
Note
The default location to store custom data generation settings is
C:\Users\Public\Public Documents\Devart\dbForge Data Generator for SQL Server\Data Generators
, and while it is not possible to change it, you can specify a custom location of .dgen files by modifying the registry at:
Computer\HKEY_CURRENT_USER\Software\Devart\dbForge Data Generator for SQL Server\Folders
.
2. In this folder, create a new .xml file.
3. Edit the file to include the necessary code.
4. Save the .xml file.
5. Start (or restart) Data Generator.
We provide some important XML tags to consider when creating a new generator.
Tag | Description |
---|---|
Category | the category a custom generator is added to |
Name | the name of a generator being added |
ShortName | the name of a generator that will be displayed in the Preview window |
Description | the description of a generator |
Type | the type of a basic generator on which a created generator is based |
Language | a language to assign a generator depending on a user’s locale |
Matches | auto-mapping rules |
ColumnTypes | data types for which a generator will be available |
Options | contains other tags for configuring a generator, depending on a generator type |
MinValue | the smallest possible value |
MaxValue | the biggest possible value |
ValueDistributionMode | represents how the generated values will be distributed in the column |
Expression | defines a pattern or path expression to load data |
FileName | the name of a file to load data from |
IsLoop | determines loop status |
Values | contains other tags for configuring a generator, depending on options required |
WeightedListItem | weighted item for random choice (each element in the list has a different probability for being selected) |
Weight | the probability for the item to appear in a generated dataset |
Value | Description |
---|---|
table=”” | a name of the matched table(s) |
column=”” | a name of the matched column(s) |
* |
any number of characters |
^ | strict beginning of a name, i.e. “^Test.*” means that the beginning of the name must be “Test”, followed by any characters (the valid table names may be the following: test, testing, Test123, etc.) |
$ | strict end of a name, i.e. “.*Test$” means that the end of the name must be “Test”, preceded by any characters (the valid table names may be the following: test, myTest, 123test, etc.) |
| |
“or” listing |
priority=”n” | mapping priority - the rule according to which a generator is automatically assigned to a column (the higher the number, the higher the priority; for the custom generators it should be higher than 4 because the default data type generators have a priority range of between 1 and 4) |
minlen=”n” | the minimum permissible length of a column (the parameter is ignored for varchar(max), nvarchar(max), text, ntext, image, and varbinary(max)) |
maxlen=”n” | the maximum length of a column (this parameter is optional; the parameter is ignored for varchar(max), nvarchar(max), text, ntext, image, and varbinary(max)) |