Using Spawner To Populate SQL Database


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.

 


  • MartinNo Gravatar

    December 3rd, 2008 05:07

    I use redgate Data generator… download, Install , Run.

  • erichansaNo Gravatar

    December 3rd, 2008 06:25

    Come on now, is it really that hard to just write a simple loop in PHP that does this?

  • James AdamsNo Gravatar

    December 3rd, 2008 06:41

    A simple loop which navigates and adheres to integrity constraints and generates realistic and appropriate data depending on the target column data type?

    Redgate Data Generator is a great tool for this, very flexible.

  • J. AcaiNo Gravatar

    December 3rd, 2008 08:13

    I generally launch a site, wait for it to fill with data, then laugh it off as it all goes horribly wrong..

  • sgNo Gravatar

    December 4th, 2008 11:20

    Look you people who push commercial software when Free Software is being promoted: You are totally missing the point. THe cost of Redgate’s software is $300 and it works only with Microsoft’s database. Are you so uninformed that you don’t know that other people out there have needs that aren’t met by your software? So ridiculous.

  • OwenNo Gravatar

    December 5th, 2008 13:05

    @Martin - I use Spawner, download install, run. Minus the cost.

    @erichansa - Please let me know when you make this “simple loop”, so that I can use it. k thanks!

    @J. Acai - Yea, some times this is the best approach. Especially if your getting under paid for the work :-P

    @JamesAdams exactly, Spawner takes that “simple loop” concept and expands upon it creating valid data.

    Unfortunately it isn’t the best at linked records but it does do its job (providing you are willing to put a little work into it)

    @sg, well said!

  • CerealNo Gravatar

    December 8th, 2008 08:09

    How did you compile Spawner? I’ve tried the compiled version but on Ubuntu 7.04 I get some errors, so I tried the sourced, I’ve installed FPC and I get this:

    fpc program.lpr
    Free Pascal Compiler version 2.2.2 [2008/07/29] for i386
    Copyright (c) 1993-2008 by Florian Klaempfl
    Target OS: Linux for i386
    Compiling program.lpr
    Fatal: Can’t find unit Interfaces used by datagen
    Fatal: Compilation aborted
    Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

    Any idea or alternative to Spawner? Thanks :)

  • OwenNo Gravatar

    December 8th, 2008 09:23

    @Cereal I used the binary, I’m not so familiar with compiling pascal programs. Did you install all of the required dependencies before hand? I may be able to help solve those if you have output from that,

    Owen.

  • CerealNo Gravatar

    December 10th, 2008 05:56

    Thank you for replying me, the binary gives me lines and lines of errors like this:

    WARNING: TGtkWidgetSet.RawImage_FromDrawable: RawImage_DescriptionFromDrawable failed
    WARNING: [TGtkWidgetSet.RawImage_FromBitmap] unable to GetRawImageFromGdkWindow Image
    TRasterImage.BitmapHandleNeeded: Unable to create handles, using default
    TGtkWidgetSet.RawImage_DescriptionFromDrawable: visual failed

    And this:

    (process:7596): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)’ failed

    And then it freeze, any idea?

  • OwenNo Gravatar

    December 10th, 2008 08:55

    @Cereal It looks like it could be a GLib error, I’m not sure what glib’s Unbuntu 7.04 uses. I have not confirmed that the Spawner binaries work with Ubuntu, but apparently they don’t work with 7.04. I’m assuming your system is up to date? As your on a PPC processor, this could be a problem with that.

  • CerealNo Gravatar

    December 10th, 2008 20:39

    No, I’m using an x86 processor, but I’m going to upgrade to Ubuntu 8.04 next week. I would let you know if the problem will continue, bye and thank you.

Trackbacks

  1. The Technology Blog: Using Spawner To Populate SQL Database
  2. nerdd.net | news and opinion
  3. Using Spawner To Populate SQL Database « Internet Making Money
  4. links for 2008-12-08 « Brent Sordyl’s Blog

Subscribe without commenting


Leave a Reply

Note: Any comments are permitted only because the site owner is letting you post, and any comments will be removed for any reason at the absolute discretion of the site owner.