File check - check columns + delimiters

Highlighted
Seven Stars

File check - check columns + delimiters

Hello all,

 

Everyday i process a csv file (Smiley Wink with 15 columns but sometimes the format of this file is not correct which may be an error with an extraction itself.

 

Types of errors with the csv file :

 

- Number of column greater than 15

- Number of column less than 15

- Number of column is 15 but certain row contain only > OR < column

 

How can i check each of these errors before processing? If one of these are found, i can use tDie to end the process.

 

In my case, i cannot use tSchemaComplianceCheck, since it verifies only type, length, null, date format?

 

Good file :

  

Nom;Prenom;Adresse;Telephone;Date de naissance;Ville
Jin;Kazama;Moka;56656496;7/11/1989;Pamplemousses
Naruto;Uzumaki;Triolet;56461654;2/12/1989;Pamplemousses
Paul;Phoenix;Soulliac;97146665;23/08/1987;Pamplemousses

 

 

Bad file :

 

Nom;Prenom;Adresse;Telephone
Jin;Kazama;Moka;56656496
Naruto;Uzumaki;Triolet;56461654
Paul;Phoenix;Soulliac;97146665
Nom;Prenom;Adresse;Telephone;Date de naissance;Ville
Jin;Kazama;Moka;56656496;7/11/1989
Naruto;Uzumaki;Triolet;56461654;2/12/1989;Pamplemousses
Paul;Phoenix;Soulliac;97146665;23/08/1987;Pamplemousses
Nom;Prenom;Adresse;Telephone;Date de naissance;Ville
Jin;Kazama;Moka;56656496;7/11/1989;Pamplemousses
Naruto;Uzumaki;Triolet;56461654;2/12/1989;Pamplemousses
Paul;Phoenix;Soulliac;97146665;Pamplemousses

 

Can you advice please?

 

Best regards,

asadasing


Accepted Solutions
Five Stars

Re: File check - check columns + delimiters

Hi,

 

In the tfileInputDelimited, in advanced settings select the option "Check each row structure against schema". Now take rejects from tfileInputDelimited. If there is any mismatch in number of columns the rows will be rejected.

 

You can count the rows in reject file, if there are any rows you can stop the process. I hope this will help.

 

Regards

Ravinder


All Replies
Fifteen Stars TRF
Fifteen Stars

Re: File check - check columns + delimiters

Hi,
As a basic solution, you can use tFileIinputFullRow, then count the number of field separators to exclude incorrect records.

TRF
Five Stars

Re: File check - check columns + delimiters

Hi,

 

In the tfileInputDelimited, in advanced settings select the option "Check each row structure against schema". Now take rejects from tfileInputDelimited. If there is any mismatch in number of columns the rows will be rejected.

 

You can count the rows in reject file, if there are any rows you can stop the process. I hope this will help.

 

Regards

Ravinder

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now