Created
May 18, 2017 04:40
-
-
Save ijokarumawak/ddf8a67162a97d022e226c706d9f3386 to your computer and use it in GitHub Desktop.
Example NiFi flow template to read records from CSV file and put those into database.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" ?> | |
<template encoding-version="1.1"> | |
<description></description> | |
<groupId>e13efe89-015b-1000-9a4c-10881ee259c9</groupId> | |
<name>Example CSV to Database</name> | |
<snippet> | |
<processGroups> | |
<id>634b599a-8ee7-3ea4-0000-000000000000</id> | |
<parentGroupId>8925b4b3-f0af-3a75-0000-000000000000</parentGroupId> | |
<position> | |
<x>0.0</x> | |
<y>0.0</y> | |
</position> | |
<comments></comments> | |
<contents> | |
<connections> | |
<id>9c217220-263a-3c7e-0000-000000000000</id> | |
<parentGroupId>634b599a-8ee7-3ea4-0000-000000000000</parentGroupId> | |
<backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold> | |
<backPressureObjectThreshold>10000</backPressureObjectThreshold> | |
<bends> | |
<x>731.0</x> | |
<y>500.0</y> | |
</bends> | |
<destination> | |
<groupId>634b599a-8ee7-3ea4-0000-000000000000</groupId> | |
<id>5f5322ef-ee3f-30aa-0000-000000000000</id> | |
<type>PROCESSOR</type> | |
</destination> | |
<flowFileExpiration>0 sec</flowFileExpiration> | |
<labelIndex>0</labelIndex> | |
<name></name> | |
<selectedRelationships>failure</selectedRelationships> | |
<source> | |
<groupId>634b599a-8ee7-3ea4-0000-000000000000</groupId> | |
<id>c2962d55-20ed-322c-0000-000000000000</id> | |
<type>PROCESSOR</type> | |
</source> | |
<zIndex>0</zIndex> | |
</connections> | |
<connections> | |
<id>c33233e3-f2cc-3610-0000-000000000000</id> | |
<parentGroupId>634b599a-8ee7-3ea4-0000-000000000000</parentGroupId> | |
<backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold> | |
<backPressureObjectThreshold>10000</backPressureObjectThreshold> | |
<destination> | |
<groupId>634b599a-8ee7-3ea4-0000-000000000000</groupId> | |
<id>c2962d55-20ed-322c-0000-000000000000</id> | |
<type>PROCESSOR</type> | |
</destination> | |
<flowFileExpiration>0 sec</flowFileExpiration> | |
<labelIndex>1</labelIndex> | |
<name></name> | |
<selectedRelationships>success</selectedRelationships> | |
<source> | |
<groupId>634b599a-8ee7-3ea4-0000-000000000000</groupId> | |
<id>8f92b5aa-a96b-3b0b-0000-000000000000</id> | |
<type>PROCESSOR</type> | |
</source> | |
<zIndex>0</zIndex> | |
</connections> | |
<connections> | |
<id>6bc0a303-d3b8-338a-0000-000000000000</id> | |
<parentGroupId>634b599a-8ee7-3ea4-0000-000000000000</parentGroupId> | |
<backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold> | |
<backPressureObjectThreshold>10000</backPressureObjectThreshold> | |
<destination> | |
<groupId>634b599a-8ee7-3ea4-0000-000000000000</groupId> | |
<id>5f5322ef-ee3f-30aa-0000-000000000000</id> | |
<type>PROCESSOR</type> | |
</destination> | |
<flowFileExpiration>0 sec</flowFileExpiration> | |
<labelIndex>0</labelIndex> | |
<name></name> | |
<selectedRelationships>success</selectedRelationships> | |
<source> | |
<groupId>634b599a-8ee7-3ea4-0000-000000000000</groupId> | |
<id>c2962d55-20ed-322c-0000-000000000000</id> | |
<type>PROCESSOR</type> | |
</source> | |
<zIndex>0</zIndex> | |
</connections> | |
<connections> | |
<id>76a6ff23-55e3-3615-0000-000000000000</id> | |
<parentGroupId>634b599a-8ee7-3ea4-0000-000000000000</parentGroupId> | |
<backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold> | |
<backPressureObjectThreshold>10000</backPressureObjectThreshold> | |
<bends> | |
<x>726.0</x> | |
<y>377.0</y> | |
</bends> | |
<bends> | |
<x>726.0</x> | |
<y>427.0</y> | |
</bends> | |
<destination> | |
<groupId>634b599a-8ee7-3ea4-0000-000000000000</groupId> | |
<id>c2962d55-20ed-322c-0000-000000000000</id> | |
<type>PROCESSOR</type> | |
</destination> | |
<flowFileExpiration>0 sec</flowFileExpiration> | |
<labelIndex>1</labelIndex> | |
<name></name> | |
<selectedRelationships>retry</selectedRelationships> | |
<source> | |
<groupId>634b599a-8ee7-3ea4-0000-000000000000</groupId> | |
<id>c2962d55-20ed-322c-0000-000000000000</id> | |
<type>PROCESSOR</type> | |
</source> | |
<zIndex>0</zIndex> | |
</connections> | |
<controllerServices> | |
<id>935058ee-a40c-3164-0000-000000000000</id> | |
<parentGroupId>634b599a-8ee7-3ea4-0000-000000000000</parentGroupId> | |
<bundle> | |
<artifact>nifi-record-serialization-services-nar</artifact> | |
<group>org.apache.nifi</group> | |
<version>1.2.0</version> | |
</bundle> | |
<descriptors> | |
<entry> | |
<key>schema-access-strategy</key> | |
<value> | |
<name>schema-access-strategy</name> | |
</value> | |
</entry> | |
<entry> | |
<key>schema-registry</key> | |
<value> | |
<identifiesControllerService>org.apache.nifi.schemaregistry.services.SchemaRegistry</identifiesControllerService> | |
<name>schema-registry</name> | |
</value> | |
</entry> | |
<entry> | |
<key>schema-name</key> | |
<value> | |
<name>schema-name</name> | |
</value> | |
</entry> | |
<entry> | |
<key>schema-text</key> | |
<value> | |
<name>schema-text</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Date Format</key> | |
<value> | |
<name>Date Format</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Time Format</key> | |
<value> | |
<name>Time Format</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Timestamp Format</key> | |
<value> | |
<name>Timestamp Format</name> | |
</value> | |
</entry> | |
<entry> | |
<key>CSV Format</key> | |
<value> | |
<name>CSV Format</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Value Separator</key> | |
<value> | |
<name>Value Separator</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Skip Header Line</key> | |
<value> | |
<name>Skip Header Line</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Quote Character</key> | |
<value> | |
<name>Quote Character</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Escape Character</key> | |
<value> | |
<name>Escape Character</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Comment Marker</key> | |
<value> | |
<name>Comment Marker</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Null String</key> | |
<value> | |
<name>Null String</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Trim Fields</key> | |
<value> | |
<name>Trim Fields</name> | |
</value> | |
</entry> | |
</descriptors> | |
<name>CSVReader</name> | |
<persistsState>false</persistsState> | |
<properties> | |
<entry> | |
<key>schema-access-strategy</key> | |
</entry> | |
<entry> | |
<key>schema-registry</key> | |
</entry> | |
<entry> | |
<key>schema-name</key> | |
</entry> | |
<entry> | |
<key>schema-text</key> | |
</entry> | |
<entry> | |
<key>Date Format</key> | |
</entry> | |
<entry> | |
<key>Time Format</key> | |
</entry> | |
<entry> | |
<key>Timestamp Format</key> | |
</entry> | |
<entry> | |
<key>CSV Format</key> | |
</entry> | |
<entry> | |
<key>Value Separator</key> | |
</entry> | |
<entry> | |
<key>Skip Header Line</key> | |
</entry> | |
<entry> | |
<key>Quote Character</key> | |
</entry> | |
<entry> | |
<key>Escape Character</key> | |
</entry> | |
<entry> | |
<key>Comment Marker</key> | |
</entry> | |
<entry> | |
<key>Null String</key> | |
</entry> | |
<entry> | |
<key>Trim Fields</key> | |
</entry> | |
</properties> | |
<state>ENABLED</state> | |
<type>org.apache.nifi.csv.CSVReader</type> | |
</controllerServices> | |
<controllerServices> | |
<id>04ce5ccf-b89f-36c4-0000-000000000000</id> | |
<parentGroupId>634b599a-8ee7-3ea4-0000-000000000000</parentGroupId> | |
<bundle> | |
<artifact>nifi-dbcp-service-nar</artifact> | |
<group>org.apache.nifi</group> | |
<version>1.2.0</version> | |
</bundle> | |
<comments></comments> | |
<descriptors> | |
<entry> | |
<key>Database Connection URL</key> | |
<value> | |
<name>Database Connection URL</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Database Driver Class Name</key> | |
<value> | |
<name>Database Driver Class Name</name> | |
</value> | |
</entry> | |
<entry> | |
<key>database-driver-locations</key> | |
<value> | |
<name>database-driver-locations</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Database User</key> | |
<value> | |
<name>Database User</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Password</key> | |
<value> | |
<name>Password</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Max Wait Time</key> | |
<value> | |
<name>Max Wait Time</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Max Total Connections</key> | |
<value> | |
<name>Max Total Connections</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Validation-query</key> | |
<value> | |
<name>Validation-query</name> | |
</value> | |
</entry> | |
</descriptors> | |
<name>DBCPConnectionPool</name> | |
<persistsState>false</persistsState> | |
<properties> | |
<entry> | |
<key>Database Connection URL</key> | |
<value>jdbc:mysql://192.168.99.100:3306/nifi_test</value> | |
</entry> | |
<entry> | |
<key>Database Driver Class Name</key> | |
<value>com.mysql.jdbc.Driver</value> | |
</entry> | |
<entry> | |
<key>database-driver-locations</key> | |
<value>/Users/koji/Downloads/mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar</value> | |
</entry> | |
<entry> | |
<key>Database User</key> | |
<value>root</value> | |
</entry> | |
<entry> | |
<key>Password</key> | |
</entry> | |
<entry> | |
<key>Max Wait Time</key> | |
</entry> | |
<entry> | |
<key>Max Total Connections</key> | |
</entry> | |
<entry> | |
<key>Validation-query</key> | |
</entry> | |
</properties> | |
<state>ENABLED</state> | |
<type>org.apache.nifi.dbcp.DBCPConnectionPool</type> | |
</controllerServices> | |
<processors> | |
<id>8f92b5aa-a96b-3b0b-0000-000000000000</id> | |
<parentGroupId>634b599a-8ee7-3ea4-0000-000000000000</parentGroupId> | |
<position> | |
<x>266.0</x> | |
<y>130.0</y> | |
</position> | |
<bundle> | |
<artifact>nifi-standard-nar</artifact> | |
<group>org.apache.nifi</group> | |
<version>1.2.0</version> | |
</bundle> | |
<config> | |
<bulletinLevel>WARN</bulletinLevel> | |
<comments></comments> | |
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount> | |
<descriptors> | |
<entry> | |
<key>File Size</key> | |
<value> | |
<name>File Size</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Batch Size</key> | |
<value> | |
<name>Batch Size</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Data Format</key> | |
<value> | |
<name>Data Format</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Unique FlowFiles</key> | |
<value> | |
<name>Unique FlowFiles</name> | |
</value> | |
</entry> | |
<entry> | |
<key>generate-ff-custom-text</key> | |
<value> | |
<name>generate-ff-custom-text</name> | |
</value> | |
</entry> | |
</descriptors> | |
<executionNode>ALL</executionNode> | |
<lossTolerant>false</lossTolerant> | |
<penaltyDuration>30 sec</penaltyDuration> | |
<properties> | |
<entry> | |
<key>File Size</key> | |
<value>0B</value> | |
</entry> | |
<entry> | |
<key>Batch Size</key> | |
<value>1</value> | |
</entry> | |
<entry> | |
<key>Data Format</key> | |
<value>Text</value> | |
</entry> | |
<entry> | |
<key>Unique FlowFiles</key> | |
<value>false</value> | |
</entry> | |
<entry> | |
<key>generate-ff-custom-text</key> | |
<value>a, b, c | |
1, two, 3 | |
</value> | |
</entry> | |
</properties> | |
<runDurationMillis>0</runDurationMillis> | |
<schedulingPeriod>1d</schedulingPeriod> | |
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy> | |
<yieldDuration>1 sec</yieldDuration> | |
</config> | |
<name>GenerateFlowFile</name> | |
<relationships> | |
<autoTerminate>false</autoTerminate> | |
<name>success</name> | |
</relationships> | |
<style></style> | |
<type>org.apache.nifi.processors.standard.GenerateFlowFile</type> | |
</processors> | |
<processors> | |
<id>c2962d55-20ed-322c-0000-000000000000</id> | |
<parentGroupId>634b599a-8ee7-3ea4-0000-000000000000</parentGroupId> | |
<position> | |
<x>271.0</x> | |
<y>337.0</y> | |
</position> | |
<bundle> | |
<artifact>nifi-standard-nar</artifact> | |
<group>org.apache.nifi</group> | |
<version>1.2.0</version> | |
</bundle> | |
<config> | |
<bulletinLevel>WARN</bulletinLevel> | |
<comments></comments> | |
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount> | |
<descriptors> | |
<entry> | |
<key>put-db-record-record-reader</key> | |
<value> | |
<identifiesControllerService>org.apache.nifi.serialization.RecordReaderFactory</identifiesControllerService> | |
<name>put-db-record-record-reader</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-statement-type</key> | |
<value> | |
<name>put-db-record-statement-type</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-dcbp-service</key> | |
<value> | |
<identifiesControllerService>org.apache.nifi.dbcp.DBCPService</identifiesControllerService> | |
<name>put-db-record-dcbp-service</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-catalog-name</key> | |
<value> | |
<name>put-db-record-catalog-name</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-schema-name</key> | |
<value> | |
<name>put-db-record-schema-name</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-table-name</key> | |
<value> | |
<name>put-db-record-table-name</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-translate-field-names</key> | |
<value> | |
<name>put-db-record-translate-field-names</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-unmatched-field-behavior</key> | |
<value> | |
<name>put-db-record-unmatched-field-behavior</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-unmatched-column-behavior</key> | |
<value> | |
<name>put-db-record-unmatched-column-behavior</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-update-keys</key> | |
<value> | |
<name>put-db-record-update-keys</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-field-containing-sql</key> | |
<value> | |
<name>put-db-record-field-containing-sql</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-quoted-identifiers</key> | |
<value> | |
<name>put-db-record-quoted-identifiers</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-quoted-table-identifiers</key> | |
<value> | |
<name>put-db-record-quoted-table-identifiers</name> | |
</value> | |
</entry> | |
<entry> | |
<key>put-db-record-query-timeout</key> | |
<value> | |
<name>put-db-record-query-timeout</name> | |
</value> | |
</entry> | |
<entry> | |
<key>rollback-on-failure</key> | |
<value> | |
<name>rollback-on-failure</name> | |
</value> | |
</entry> | |
</descriptors> | |
<executionNode>ALL</executionNode> | |
<lossTolerant>false</lossTolerant> | |
<penaltyDuration>30 sec</penaltyDuration> | |
<properties> | |
<entry> | |
<key>put-db-record-record-reader</key> | |
<value>935058ee-a40c-3164-0000-000000000000</value> | |
</entry> | |
<entry> | |
<key>put-db-record-statement-type</key> | |
<value>INSERT</value> | |
</entry> | |
<entry> | |
<key>put-db-record-dcbp-service</key> | |
<value>04ce5ccf-b89f-36c4-0000-000000000000</value> | |
</entry> | |
<entry> | |
<key>put-db-record-catalog-name</key> | |
</entry> | |
<entry> | |
<key>put-db-record-schema-name</key> | |
</entry> | |
<entry> | |
<key>put-db-record-table-name</key> | |
<value>csvs</value> | |
</entry> | |
<entry> | |
<key>put-db-record-translate-field-names</key> | |
<value>true</value> | |
</entry> | |
<entry> | |
<key>put-db-record-unmatched-field-behavior</key> | |
<value>Ignore Unmatched Fields</value> | |
</entry> | |
<entry> | |
<key>put-db-record-unmatched-column-behavior</key> | |
<value>Fail on Unmatched Columns</value> | |
</entry> | |
<entry> | |
<key>put-db-record-update-keys</key> | |
</entry> | |
<entry> | |
<key>put-db-record-field-containing-sql</key> | |
</entry> | |
<entry> | |
<key>put-db-record-quoted-identifiers</key> | |
<value>false</value> | |
</entry> | |
<entry> | |
<key>put-db-record-quoted-table-identifiers</key> | |
<value>false</value> | |
</entry> | |
<entry> | |
<key>put-db-record-query-timeout</key> | |
<value>0 seconds</value> | |
</entry> | |
<entry> | |
<key>rollback-on-failure</key> | |
<value>false</value> | |
</entry> | |
</properties> | |
<runDurationMillis>0</runDurationMillis> | |
<schedulingPeriod>0 sec</schedulingPeriod> | |
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy> | |
<yieldDuration>1 sec</yieldDuration> | |
</config> | |
<name>PutDatabaseRecord</name> | |
<relationships> | |
<autoTerminate>false</autoTerminate> | |
<name>failure</name> | |
</relationships> | |
<relationships> | |
<autoTerminate>false</autoTerminate> | |
<name>retry</name> | |
</relationships> | |
<relationships> | |
<autoTerminate>false</autoTerminate> | |
<name>success</name> | |
</relationships> | |
<style></style> | |
<type>org.apache.nifi.processors.standard.PutDatabaseRecord</type> | |
</processors> | |
<processors> | |
<id>5f5322ef-ee3f-30aa-0000-000000000000</id> | |
<parentGroupId>634b599a-8ee7-3ea4-0000-000000000000</parentGroupId> | |
<position> | |
<x>265.0</x> | |
<y>528.0</y> | |
</position> | |
<bundle> | |
<artifact>nifi-standard-nar</artifact> | |
<group>org.apache.nifi</group> | |
<version>1.2.0</version> | |
</bundle> | |
<config> | |
<bulletinLevel>WARN</bulletinLevel> | |
<comments></comments> | |
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount> | |
<descriptors> | |
<entry> | |
<key>Log Level</key> | |
<value> | |
<name>Log Level</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Log Payload</key> | |
<value> | |
<name>Log Payload</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Attributes to Log</key> | |
<value> | |
<name>Attributes to Log</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Attributes to Ignore</key> | |
<value> | |
<name>Attributes to Ignore</name> | |
</value> | |
</entry> | |
<entry> | |
<key>Log prefix</key> | |
<value> | |
<name>Log prefix</name> | |
</value> | |
</entry> | |
</descriptors> | |
<executionNode>ALL</executionNode> | |
<lossTolerant>false</lossTolerant> | |
<penaltyDuration>30 sec</penaltyDuration> | |
<properties> | |
<entry> | |
<key>Log Level</key> | |
<value>info</value> | |
</entry> | |
<entry> | |
<key>Log Payload</key> | |
<value>false</value> | |
</entry> | |
<entry> | |
<key>Attributes to Log</key> | |
</entry> | |
<entry> | |
<key>Attributes to Ignore</key> | |
</entry> | |
<entry> | |
<key>Log prefix</key> | |
</entry> | |
</properties> | |
<runDurationMillis>0</runDurationMillis> | |
<schedulingPeriod>0 sec</schedulingPeriod> | |
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy> | |
<yieldDuration>1 sec</yieldDuration> | |
</config> | |
<name>LogAttribute</name> | |
<relationships> | |
<autoTerminate>false</autoTerminate> | |
<name>success</name> | |
</relationships> | |
<style></style> | |
<type>org.apache.nifi.processors.standard.LogAttribute</type> | |
</processors> | |
</contents> | |
<name>Example CSV to Database</name> | |
</processGroups> | |
</snippet> | |
<timestamp>05/18/2017 13:38:25 JST</timestamp> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment