To read further details, click the error.Īt this point you have options to view the sample generated data or view the actual data in the table.įixing the problem would mean to edit the pattern for the problematic column.Īs explained in the Table Generator Dialog, you can edit for each column the: In the Generator Dialog, select one of the tables, and the errors will showĪt the bottom. You can choose a pattern from the repository and edit it in the table pattern dialog.ĭifferent errors may occur when generating the data. The pattern repository is storing predefined patterns.ĭbSchema tries to find one pattern for each column, but this does not always work. Two columns with the same pattern and seed will generate identical values. If the column is not mandatory, this field is marked with a red '*'. In the next dialog, you can edit the table patterns, the percent of null values, and the seed. Please make sure you don't drop data on production databases! Carefully read DbSchema messages. When clicking the 'Generate' button, it will ask to drop or not the current data. Refers to the table Country, the table City should be the first in the list.ĭbSchema will try to order of the tables, which sometimes may fail, if for example, there are foreign keys in a loop.Īfter opening the dialog, DbSchema will check if the tables contain data or not. The table order is important for minimizing errors caused by foreign keys. The dialog is also showing the table status: if it currently contains data or not.ĭouble-click any of the tables for editing the generator settings. Set the number of data rows to be generated for each table and the table order. Start the Data Generator from the Data Tools application menu or by right-clicking any table header. Saving the model file will save the layouts as well as the data generator settings. dbs model file.įirst, create a layout with the tables for which you want to generate random data.Įach time you need a different set of tables, you have to create a new layout. The generator patterns are saved for each column in the model file. You can choose and edit for each column one of the predefined patterns from the Pattern Repository.
The first time you access the Data Generator feature, DbSchema will try to find a pattern for you. All other patterns will be interpreted as Reverse Regular Expressions.$patternA $patternB - combine two patterns.groovy: - use own script to generate values.json_list: json_map: - we use this for MongoDb.Pick up a value from the Primary Key table. load_values_from_pk - foreign key columns (involved in a foreign key, referring other columns) should use this pattern.skip: - skip the column from generator (do not generate).Like int, short, sequence, boolean, groovy, etc.Īny other pattern which doesn't start with one of these keywords will be interpreted as reverse regular expressions. There are dedicated patterns for numbers, date, booleans, starting with a keyword The random generator is using patterns for setting how the generated data should look like. If you need to generate credit card numbers you might want to try this other tool.Use the Data Generator to fill database tables with random data. If you find that you like the tool and would fancy more features, or even just for regular feedback, don't hesitate in telling me at. you can only save/load one structure at a time). I've created this because I needed something like it and hadn't found it before. Hit "Load recipe" whenever you come back and your structure will be waiting for you. When you've created a table structure that you think you might want to keep while you play with the tool or even one to come back to on another day, just hit "Save recipe". You might have to wait a bit if you select a high enough number though. You can also generate as many rows as you wish by inserting the desired number on top-right input called "Generated rows". Return to the homepage and select "Full Custom" or add columns by clicking "Add another column", to represent your table schema. Select a table structure from the default list and hit "Generate data" to see an example with 10 rows of fake data. Generating fixtures has never been easier. This is an attempt at making the problem smaller. Manually inserting 3 or 4 rows in each table just isn't good enough. Both of these situations benefit from having a large body of data that is semi-coherent (so you can kind of inspect it) but that is automatically generated. You might test it for correctness and you might test it for load. When developing an application, you would be wise to test it. Why do I need to fill a database with random data?