There are many reasons why you would want to generate bogus data for your database. Perhaps you’d like to know how well your databases will perform when filled with data, or maybe you just need some data so that you can start creating a front end for the database. I recently ran into the problem of not wanting to generate lots of data manually. I initially thought that I would write a shell script to do this, but figured I might as well look around first. I stumbled across a program called Spawner which is great for generating data for database testing.
Once you’ve downloaded spawner from sourceforge you’ll probably have to install some libraries. I had to install gtkhtml, gnome-spell2, gdk-pixbuf and glib on OpenSuse and very similar packages on Fedora 8.
To run the binary, I extracted it, moved it into my opt directory and chowned and chmodded the file. You should be able to do the following if you don’t know how to do it.
wget http://downloads.sourceforge.net/spawner/spawner-0.1.5-linux-i386.tar.gz?modtime=1223296659&big_mirror=0 tar xvzf spawner-0.1.5-linux-i386.tar.gz
(as root, or sudo)
sudo mv spawner-0.1.5-linux-i386 /opt/ sudo chown YOURUSER:YOURGROUP /opt/spawner-0.1.5-linux-i386
Once you’ve done that, to execute it you just type /opt/spawner-0.1.5-linux-i386/spawner and it should start right up if you have all of the dependencies installed.
Spawner is fairly simple to use but does have some “quirks” that I have noticed. From the main screen, you have three tabs; Fields, Output and Message log. The fields tab is used to enter your fields of your table. You specify the field name and type here. Notes: You must hit the save button for each field and sometimes using the arrow keys for the field types helps with selecting them. Once you have defined your fields I’d recommend saving them, just in case.
Once you have your field definitions set you can work the output tab. You can choose the output type as delimited, SQL or a MySQL Database. The first two options need an output file while the latter you will need your connection information. The output tab is also where you specify the number of records to generate.
Click the Spawn button! You can look at the “Message Log” tab for errors. If it only inserts one record, click the spawn again and see if it starts generating the amount of records you specified. Occasionally it will only generate one record without it being your fault, but chances are if it doesn’t start spawning records you may have specified a field name incorrectly, you’re trying to put invalid data into a field, your connection information is incorrect or your using the wrong database/table.