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 Continue reading