Handling customer data is very key and sometimes, you do not want to use your real customer’s data and information during development. However you would want to generate some dummy data in Talend and use for your development and testing purposes.

In this short tutorial, we are going to use TRowGenerator in Talend and then insert the data into a PostgreSQL database’ table.

  1. First let’s create our job and give it a name example, GenerateDummyCustomerData 
  2. Now let’s go to the Palette and under the Misc group of components let’s pick and drop the TRowGenerator on the workbench 
  3. Let’s select the TRowGenerator component and edit its schema 
  4. Now let’s define how we are going to generate the data by clicking on the …. next to the RowGenerator Editor 
  5. We are going to use Talend Inbuilt functions for generating data for our schema. Hence will use Numeric.Sequence for the CustomerID which will give us a incremental integers for our CustomerId field. So all our schema will be filled with data with these functions: FirstName =  TalendDataGenerator.getFirstName()  ; LastName= TalendDataGenerator.getLastName(); State = TalendDataGenerator.getUsState()
  6. Now let’s create a table in PostgreSQL database and call it CustomerDummyData and import the schema into Talend
  7. Let’s define the columns to be same as our talend TRowGenerator schema 
  8. Now in Talend let’s go to Metadata and connect to our PostgreSQL database and schema and then retrieve the schema of the newly created table
  9. Follow the onscreen instructions to retrieve the table name and schema 
  10. Now that we have our schema imported lets drag it onto our workbench as our output component by chosing tPostgresqlOutput component from the pop up window
  11. Now let’s connect our TRowGenerator  to our PostgreSQL output component. You will be asked if ” you want to get the schema of the output component.” It is better to get the the schema by clicking YES as the schema are the same or you can ignore (note : if you click yes, you will have re-select your data generating functions again)
  12. Re-select the data generating functions again if you clicked YES and you can also change the number of rows you want to generate as in the image below:
  13. Now run your job 
  14. Job should run fine. You can now check your dummy data outputted in your PostgreSQL database table CustomerDummyData
  15. Hope this helps
  16. Summary:  1 .You learned a simple way to generate sample data through talend for development purposes 2. You learned how to insert the data into a PostgreSQL database

If you have any questions or other ways of achieving similar thing, please leave your comments in the comment box below

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *