Skip to content

Instantly share code, notes, and snippets.

@rishuatgithub
Created February 17, 2015 08:26
Show Gist options
  • Save rishuatgithub/97770697d6a34b03cde8 to your computer and use it in GitHub Desktop.
Save rishuatgithub/97770697d6a34b03cde8 to your computer and use it in GitHub Desktop.
Read CSV and Execute using Java
<?xml version="1.0" encoding="UTF-8"?>
<transformation>
<info>
<name>T_ReadCSVJava</name>
<description/>
<extended_description/>
<trans_version/>
<trans_type>Normal</trans_type>
<trans_status>0</trans_status>
<directory>&#47;</directory>
<parameters>
<parameter>
<name>file_employee</name>
<default_value>Employee.csv</default_value>
<description/>
</parameter>
<parameter>
<name>file_loan</name>
<default_value>loan.csv</default_value>
<description/>
</parameter>
</parameters>
<log>
<trans-log-table><connection/>
<schema/>
<table/>
<size_limit_lines/>
<interval/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STATUS</id><enabled>Y</enabled><name>STATUS</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name><subject/></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name><subject/></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name><subject/></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name><subject/></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name><subject/></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name><subject/></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>STARTDATE</id><enabled>Y</enabled><name>STARTDATE</name></field><field><id>ENDDATE</id><enabled>Y</enabled><name>ENDDATE</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>DEPDATE</id><enabled>Y</enabled><name>DEPDATE</name></field><field><id>REPLAYDATE</id><enabled>Y</enabled><name>REPLAYDATE</name></field><field><id>LOG_FIELD</id><enabled>Y</enabled><name>LOG_FIELD</name></field></trans-log-table>
<perf-log-table><connection/>
<schema/>
<table/>
<interval/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>SEQ_NR</id><enabled>Y</enabled><name>SEQ_NR</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>INPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>INPUT_BUFFER_ROWS</name></field><field><id>OUTPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>OUTPUT_BUFFER_ROWS</name></field></perf-log-table>
<channel-log-table><connection/>
<schema/>
<table/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>LOGGING_OBJECT_TYPE</id><enabled>Y</enabled><name>LOGGING_OBJECT_TYPE</name></field><field><id>OBJECT_NAME</id><enabled>Y</enabled><name>OBJECT_NAME</name></field><field><id>OBJECT_COPY</id><enabled>Y</enabled><name>OBJECT_COPY</name></field><field><id>REPOSITORY_DIRECTORY</id><enabled>Y</enabled><name>REPOSITORY_DIRECTORY</name></field><field><id>FILENAME</id><enabled>Y</enabled><name>FILENAME</name></field><field><id>OBJECT_ID</id><enabled>Y</enabled><name>OBJECT_ID</name></field><field><id>OBJECT_REVISION</id><enabled>Y</enabled><name>OBJECT_REVISION</name></field><field><id>PARENT_CHANNEL_ID</id><enabled>Y</enabled><name>PARENT_CHANNEL_ID</name></field><field><id>ROOT_CHANNEL_ID</id><enabled>Y</enabled><name>ROOT_CHANNEL_ID</name></field></channel-log-table>
<step-log-table><connection/>
<schema/>
<table/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>LOG_FIELD</id><enabled>N</enabled><name>LOG_FIELD</name></field></step-log-table>
</log>
<maxdate>
<connection/>
<table/>
<field/>
<offset>0.0</offset>
<maxdiff>0.0</maxdiff>
</maxdate>
<size_rowset>10000</size_rowset>
<sleep_time_empty>50</sleep_time_empty>
<sleep_time_full>50</sleep_time_full>
<unique_connections>N</unique_connections>
<feedback_shown>Y</feedback_shown>
<feedback_size>50000</feedback_size>
<using_thread_priorities>Y</using_thread_priorities>
<shared_objects_file/>
<capture_step_performance>N</capture_step_performance>
<step_performance_capturing_delay>1000</step_performance_capturing_delay>
<step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
<dependencies>
</dependencies>
<partitionschemas>
</partitionschemas>
<slaveservers>
</slaveservers>
<clusterschemas>
</clusterschemas>
<created_user>-</created_user>
<created_date>2015&#47;02&#47;17 13:30:20.383</created_date>
<modified_user>-</modified_user>
<modified_date>2015&#47;02&#47;17 13:30:20.383</modified_date>
</info>
<notepads>
</notepads>
<connection>
<name>AgileBI</name>
<server>localhost</server>
<type>MONETDB</type>
<access>Native</access>
<database>pentaho-instaview</database>
<port>50000</port>
<username>monetdb</username>
<password>Encrypted 2be98afc86aa7f2e4cb14a17edb86abd8</password>
<servername/>
<data_tablespace/>
<index_tablespace/>
<attributes>
<attribute><code>EXTRA_OPTION_INFOBRIGHT.characterEncoding</code><attribute>UTF-8</attribute></attribute>
<attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
<attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
<attribute><code>PORT_NUMBER</code><attribute>50000</attribute></attribute>
</attributes>
</connection>
<connection>
<name>CManage_SIT_ETL</name>
<server>10.237.69.90</server>
<type>MYSQL</type>
<access>Native</access>
<database>CManage_ETL</database>
<port>3306</port>
<username>s1c798adm</username>
<password>Encrypted 2ddf5cea60bc09785af14a77efec5f682</password>
<servername/>
<data_tablespace/>
<index_tablespace/>
<attributes>
<attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
<attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
<attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
<attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
<attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
<attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
<attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
<attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
<attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
<attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
</attributes>
</connection>
<connection>
<name>CManage_SIT_Mart</name>
<server>10.237.69.90</server>
<type>MYSQL</type>
<access>Native</access>
<database>CManage_MART</database>
<port>3306</port>
<username>s1c798adm</username>
<password>Encrypted 2ddf5cea60bc09785af14a77efec5f682</password>
<servername/>
<data_tablespace/>
<index_tablespace/>
<attributes>
<attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
<attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
<attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
<attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
<attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
<attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
<attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
<attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
<attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
<attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
</attributes>
</connection>
<order>
<hop> <from>Employee</from><to>Lookup with Emplid</to><enabled>Y</enabled> </hop> <hop> <from>loan</from><to>Lookup with Emplid</to><enabled>Y</enabled> </hop> <hop> <from>Lookup with Emplid</from><to>Output</to><enabled>Y</enabled> </hop> </order>
<step>
<name>Employee</name>
<type>CsvInput</type>
<description/>
<distribute>Y</distribute>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<filename>${Internal.Transformation.Filename.Directory}&#47;${file_employee}</filename>
<filename_field/>
<rownum_field/>
<include_filename>N</include_filename>
<separator>,</separator>
<enclosure>&quot;</enclosure>
<header>Y</header>
<buffer_size>50000</buffer_size>
<lazy_conversion>N</lazy_conversion>
<add_filename_result>N</add_filename_result>
<parallel>N</parallel>
<newline_possible>N</newline_possible>
<encoding/>
<fields>
<field>
<name>emplid</name>
<type>Integer</type>
<format>#</format>
<currency>$</currency>
<decimal>.</decimal>
<group>,</group>
<length>15</length>
<precision>-1</precision>
<trim_type>none</trim_type>
</field>
<field>
<name>name</name>
<type>String</type>
<format/>
<currency>$</currency>
<decimal>.</decimal>
<group>,</group>
<length>1</length>
<precision>-1</precision>
<trim_type>none</trim_type>
</field>
<field>
<name>age</name>
<type>Integer</type>
<format>#</format>
<currency>$</currency>
<decimal>.</decimal>
<group>,</group>
<length>15</length>
<precision>-1</precision>
<trim_type>none</trim_type>
</field>
<field>
<name>education</name>
<type>String</type>
<format/>
<currency>$</currency>
<decimal>.</decimal>
<group>,</group>
<length>3</length>
<precision>-1</precision>
<trim_type>none</trim_type>
</field>
</fields>
<cluster_schema/>
<remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
<xloc>211</xloc>
<yloc>16</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>loan</name>
<type>CsvInput</type>
<description/>
<distribute>Y</distribute>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<filename>${Internal.Transformation.Filename.Directory}&#47;${file_loan}</filename>
<filename_field/>
<rownum_field/>
<include_filename>N</include_filename>
<separator>,</separator>
<enclosure>&quot;</enclosure>
<header>Y</header>
<buffer_size>50000</buffer_size>
<lazy_conversion>N</lazy_conversion>
<add_filename_result>N</add_filename_result>
<parallel>N</parallel>
<newline_possible>N</newline_possible>
<encoding/>
<fields>
<field>
<name>loan</name>
<type>Integer</type>
<format>#</format>
<currency>$</currency>
<decimal>.</decimal>
<group>,</group>
<length>15</length>
<precision>-1</precision>
<trim_type>none</trim_type>
</field>
<field>
<name>balance</name>
<type>Integer</type>
<format>#</format>
<currency>$</currency>
<decimal>.</decimal>
<group>,</group>
<length>15</length>
<precision>-1</precision>
<trim_type>none</trim_type>
</field>
<field>
<name>emplid</name>
<type>Integer</type>
<format>#</format>
<currency>$</currency>
<decimal>.</decimal>
<group>,</group>
<length>15</length>
<precision>-1</precision>
<trim_type>none</trim_type>
</field>
</fields>
<cluster_schema/>
<remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
<xloc>63</xloc>
<yloc>22</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Lookup with Emplid</name>
<type>StreamLookup</type>
<description/>
<distribute>Y</distribute>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<from>Employee</from>
<input_sorted>N</input_sorted>
<preserve_memory>Y</preserve_memory>
<sorted_list>N</sorted_list>
<integer_pair>N</integer_pair>
<lookup>
<key>
<name>emplid</name>
<field>emplid</field>
</key>
<value>
<name>name</name>
<rename>name</rename>
<default/>
<type>String</type>
</value>
<value>
<name>age</name>
<rename>age</rename>
<default/>
<type>Integer</type>
</value>
<value>
<name>education</name>
<rename>education</rename>
<default/>
<type>String</type>
</value>
</lookup>
<cluster_schema/>
<remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
<xloc>148</xloc>
<yloc>95</yloc>
<draw>Y</draw>
</GUI>
</step>
<step>
<name>Output</name>
<type>TextFileOutput</type>
<description/>
<distribute>Y</distribute>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<separator>,</separator>
<enclosure>&quot;</enclosure>
<enclosure_forced>N</enclosure_forced>
<enclosure_fix_disabled>N</enclosure_fix_disabled>
<header>Y</header>
<footer>N</footer>
<format>DOS</format>
<compression>None</compression>
<encoding/>
<endedLine/>
<fileNameInField>N</fileNameInField>
<fileNameField/>
<create_parent_folder>N</create_parent_folder>
<file>
<name>${Internal.Transformation.Filename.Directory}&#47;result</name>
<is_command>N</is_command>
<servlet_output>N</servlet_output>
<do_not_open_new_file_init>N</do_not_open_new_file_init>
<extention>csv</extention>
<append>N</append>
<split>N</split>
<haspartno>N</haspartno>
<add_date>N</add_date>
<add_time>N</add_time>
<SpecifyFormat>N</SpecifyFormat>
<date_time_format/>
<add_to_result_filenames>Y</add_to_result_filenames>
<pad>N</pad>
<fast_dump>N</fast_dump>
<splitevery>0</splitevery>
</file>
<fields>
<field>
<name>loan</name>
<type>Integer</type>
<format>0</format>
<currency/>
<decimal/>
<group/>
<nullif/>
<trim_type>both</trim_type>
<length>-1</length>
<precision>-1</precision>
</field>
<field>
<name>balance</name>
<type>Integer</type>
<format>0</format>
<currency/>
<decimal/>
<group/>
<nullif/>
<trim_type>both</trim_type>
<length>-1</length>
<precision>-1</precision>
</field>
<field>
<name>emplid</name>
<type>Integer</type>
<format>0</format>
<currency/>
<decimal/>
<group/>
<nullif/>
<trim_type>both</trim_type>
<length>-1</length>
<precision>-1</precision>
</field>
<field>
<name>name</name>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<nullif/>
<trim_type>both</trim_type>
<length>-1</length>
<precision>-1</precision>
</field>
<field>
<name>age</name>
<type>Integer</type>
<format>0</format>
<currency/>
<decimal/>
<group/>
<nullif/>
<trim_type>both</trim_type>
<length>-1</length>
<precision>-1</precision>
</field>
<field>
<name>education</name>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<nullif/>
<trim_type>both</trim_type>
<length>-1</length>
<precision>-1</precision>
</field>
</fields>
<cluster_schema/>
<remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
<xloc>148</xloc>
<yloc>195</yloc>
<draw>Y</draw>
</GUI>
</step>
<step_error_handling>
</step_error_handling>
<slave-step-copy-partition-distribution>
</slave-step-copy-partition-distribution>
<slave_transformation>N</slave_transformation>
</transformation>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment