Hi i am very new to pentaho kettle-spoon. I want a sample program which takes input from .csv file and push into database and after certain time like 2:30 am a job will run and few records from that database(sql developer) in csv format will emailed to user. I am using Java to call the transformation like:
public static void main(String[] args) {
try {
KettleEnvironment.init();
TransMeta metaData = new TransMeta("hello.ktr");
Trans trans = new Trans( metaData );
trans.execute( null );
trans.waitUntilFinished();
if ( trans.getErrors() > 0 ) {
System.out.print( "Error Executing transformation" );
}
}
catch( KettleException e ) {
e.printStackTrace();
}
}
Here I have created HelloWorld(hello.ktr) program in Spoon and called it in java code. I want to do similar. Making transformation and job in spoon and calling in my java code. kindly help me out with it.
Why don't you schedule the program to run at 2:30AM using crontab? In lunux, create a script called whatever you want e.g start.sh and add the following script code:
Then create another script maybe called transScript like /root/transScript.sh and add the following in script to run the transformation using pan. pan is the tool that runs kettle transformations via the command line. For running kettle jobs via command line, you have to use kitchen.
Then all you have to do is run this command to begin the scheduled task: