pysert (with lowercase ‘p’) is a python script capable of generating random SQL data (INSERTS) from predefined templates .

How it works:

Let’s suppose you want to in fill the ‘Employees’ table in your application with 100 random entries . The table has the following columns: (employee_id, first_name, last_name, email, job_id, salary) .

The first step will be to write the pysert template .  The template is a a simple XML file divided into two sections:

  • A declarative area – Here you define the data sets from which the data is generated ;
  • The template string  – The actual string from which the output is generated .
A possible pysert template for our ‘Employees’ table will look like this:


Once the template is ready you can use the script to generate the results . In it’s current form the script works perfectly with both python 2.7.x and python 3.2.x series .

The generated output will be printed directly to stdout (unless you specify an –output FILE):

Luckily for us the data was generated and everybody is happy!


You can download the latest version from here, or directly from svn:

The file on svn can be found here .

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url=""> 


Are we human, or are we dancer *