Skip to main content

In writing previous blogs, I found myself having to search for old tables in which I had data to perform specific processing just to give examples and to make clear concepts.


However, the data I had available did not always match my needs, so I asked myself : how to generate fake realistic data?
I turned to Mockaroo one of the platforms for generating fake but realistic data.

Mockaroo initial interface

Type of data

The databases we use and would like to populate can contain data of many different types, and a strength of Mockaroo is the amount of data types it provides. There are as many as 169 of them!

Need a table that describe a person? You can find all the fields you are interested in: first name, last name, phone number, email address, gender. If the person described by this first table wanted to take a trip you can find all kinds of data to describe it :address, country, airport name, airport code and so on.

So, if you find yourself needing to populate any table you will likely find the types of data you need!

Exploring Data types

My favorite data type?
The Naughty string: «string which have high probability of causing issues when used as a user input data» (probably if your application can handle this then it can handle anything!).

Example of Naughty strings

Insertion

When a new column is inserted some processing is possible.
For example, for a numeric datum you can select the range in which to generate it and the number of decimal places.
Remember: each data type has different customizable characteristics.
For each of the columns you can decide the percentage of rows containing null values.

Customizable characteristics for Number and State types

Very interesting feature is the Formula that provides a coding window where you can do some processing on the data generated by the platform.

Logical and mathematical operators are supported, you can create conditional statements and access some specific functions.

Formula coding window

Exporting

After deciding on the types of columns to include in our table and before exporting it, it is necessary to set some characteristics:

  • the number of rows
  • the type of format in which to export it (CSV, JSON, Tab-Delimited, SQL, Cassandra CQL, Firebase, InfluxDB, Custom, Excel and XML are supported)

The format I am interested in is SQL, once selected I can choose the name of the table and also if I want the SQL statement for creating the table to be generated as well.

If I am satisfied with the preview I can proceed to download the file.

Example of data export

Cons

As you can see in the video the insertion of data into the table happens one row at a time so as many queries will be executed as there are rows to be inserted (+1 if there is also creation).


Another thing that is not really consonant if you want to use the product code for more demanding applications, is the absence of option to set primary key, foreign key and other details that might be formally and functionally relevant.

Additional strengths

Mockaroo offers additional possibilities:
If you have an account you can save your table templates and then use them when you need them.


It provides a Rest API that provides access to artificially constructed data in real time and without a call limit.

Auteur