Reputation: 157
I'm using Pentaho DI (kettle) and not sure what's the best way to do the following: From a downloaded csv file, check if a column exists, and based on that select the right next step. There are 3 possible options.
Thanks, Isaac
Upvotes: 0
Views: 716
Reputation: 17147
You did not mention possible options, so I'll just provide you with a sketch showing how to check if a column exists in a file.
For this you will need a CSV file input
step and Metadata structure of stream
step which will read the metadata of the incoming stream.
For a sample csv file with 3 columns named col1
, col2
and col3
you get every column in a separate row with its name as a value in Fieldname
column in Metadata step.
Then depending on your needs you could use for example Filter Rows
or Switch / Case
step for further processing.
Upvotes: 2