Sunday, 3 May 2009

Populating Databases with random data using Spawner

Spawner is an open source tool for generating data to populate databases. There are Linux and Windows binaries for it.

First thing out of box is the Linux version won't run on my Ubuntu 9.04 install with the following error message “./spawner: error while loading shared libraries: libglib-1.2.so.0: cannot open shared object file: No such file or directory”. Seeing I have Wine installed, I just thought I would get the Windows version and try that. Well under Wine it loaded up fine, so won't spend any more time trying to get it to work under Linux. Though if anyone knows what I need to do to get it to work please leave a comment.

Well Spawner opens up with a fairly simple UI.



The first tab is the main one in which you describe the table that you want to populate. It can randomly make numbers, strings and dates, but it can also do some smarts with these like sequences, ranges, number of word, number of characters, humans like names, emails, addresses and SSNs (shame this isn't tweakable to handle IR number for here in NZ XXX-XXX-XXX or maybe bank account numbers XX-XXXX-XXXXXXXX-XXX). It will also make IPv4 addresses but not IPv6 addresses.



Once you have set up your output options. It will make you a CSV file, a SQL file with inserts or directly place the information into a MySQL database. Just select how many rows you would like and press the go button and voilĂ  there you go a file with all your data in it ready to place into your DB.



Some features that I would like to see in it are what I have mentioned above with more data types and/or maybe something where you could define your own format mask, which would come in handy for country specific things like bank account and phone numbers. The other thing which could come in handy with be the ability to do parent child tables. Though thinking about you do it manually using number ranges on the ID column. It also doesn't seem to handle putting binary data into a column though I guess with this would need to point it at a directory with some images or documents in it. Another output type that would come in handy would be an XML type which could give the XSD to and could tell Spawner how to populate each field be it randomly or with a a static value. Though with XML the child table feature may come in handy so you can do nesting of data.

4 comments:

Seth said...

I'm the developer. In ubuntu if you install the libgdk-pixbuf2 it should work. If it doesn't let me know.

As for the feature requests I'll see if/when I can get to it, things are busy at work lately and I don't have a lot of free time of my own. :)

Seth said...

I posted a few minutes ago but I don't think blogger accepted it...

I've implemented a "Masked String" subtype under "Text", which allows you
to specify a mask using these special characters:
* - any printable character
a - a letter (any case)
l - a letter (lower case)
L - a letter (upper case)
9 - a number
\ - whatever the following character is, as is

Any other characters are simply inserted into the result as is.

I'll try to get a new build up with that feature next week, the code is in
SVN now.

As for your other feature requests they are apt to be quite a bit more
work, and I'm pretty slammed right now, so I'm not sure when I'll get to
them.

By the way, to run under ubuntu you'll probably need the libgdk-pixbuf2
package installed.

-SG

Bhavtia said...

can U plz tel me How to randomy populate database in ur SQL project...??

plz reply as soon as possible

Karit said...

Bhavtia umm this post covers it is there any thing in particular you need help with?