<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Error when copying CSV files from Windows directory into SQL Server DB by using Apache NiFi in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311515#M224703</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/85508"&gt;@BerniHacker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I see the cause could be different column names and in the &lt;STRONG&gt;PutDatabaseRecord&lt;/STRONG&gt; the option "Unmatched Column Behavior" is set to "Fail on Unmatched Columns".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose the options concerning "Unmatched Field Behavior" or "Unmatched Column Behavior" in connection with "Translate Field Names" causing your problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps you like to post your schema-definition?&lt;BR /&gt;But at the moment I can't give you a concreter answer.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Feb 2021 06:47:29 GMT</pubDate>
    <dc:creator>justenji</dc:creator>
    <dc:date>2021-02-16T06:47:29Z</dc:date>
    <item>
      <title>Error when copying CSV files from Windows directory into SQL Server DB by using Apache NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311492#M224687</link>
      <description>&lt;DIV class="s-prose js-post-body"&gt;&lt;P&gt;I am trying to copy &lt;STRONG&gt;CSV&lt;/STRONG&gt; files from my local directory into a &lt;STRONG&gt;SQL Server&lt;/STRONG&gt; database running in my local machine by using &lt;STRONG&gt;Apache NiFi&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to the tool and I have been spending few days googling and building my flow. I managed to connect to source and destination but still I am not able to populate the database since I get the following error: "&lt;EM&gt;None of the fields in the record map to the columns defined by the tablename table&lt;/EM&gt;."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been struggling with this for a while and I have not been able to find a solution in the Web.&lt;/P&gt;&lt;P&gt;Any hint would be highly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are further details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have built a simple flow using &lt;STRONG&gt;GetFile&lt;/STRONG&gt; and &lt;STRONG&gt;PutDatabaseRecord&lt;/STRONG&gt; processors&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="flow.png" style="width: 420px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30397i2E082C5AA2914723/image-size/large?v=v2&amp;amp;px=999" role="button" title="flow.png" alt="flow.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My input is a simple table with 8 columns&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="csv_table.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30398i8F7776CBA4EAAB59/image-size/large?v=v2&amp;amp;px=999" role="button" title="csv_table.png" alt="csv_table.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My configurations for GetCSV process are here (I have added the input directory and left the rest as default)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="getcsv.png" style="width: 789px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30399i9ED5F84D422CF05B/image-size/large?v=v2&amp;amp;px=999" role="button" title="getcsv.png" alt="getcsv.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The configuration for PutDatabaseRecord process is here (I have referred to the CSVReader and DBCPConnectionPool controller services, used the MS SQL 2012+ database type (I have 2019 version), configured INSERT statement type, inserted the schema and correct table name and left everything else as default)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="put_database_record.png" style="width: 793px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30400i9FE721FE47A2D908/image-size/large?v=v2&amp;amp;px=999" role="button" title="put_database_record.png" alt="put_database_record.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The CSVReader configuration looks as shown here (Schema Access Strategy = Use String Fields From Header; CSV Format = Microsoft Excel)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="csv_reader.png" style="width: 795px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30401iE5226573235F1498/image-size/large?v=v2&amp;amp;px=999" role="button" title="csv_reader.png" alt="csv_reader.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is the configuration of the DBCPConnectionPool (I have added the correct URL, DB driver class name, driver location, DB user and password)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dbcp.png" style="width: 793px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30402i11C53664B4739E58/image-size/large?v=v2&amp;amp;px=999" role="button" title="dbcp.png" alt="dbcp.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, this is a snapshot of the description of the table I have created in the database to host the content&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="db.png" style="width: 829px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30403iF752A18C762A7FB9/image-size/large?v=v2&amp;amp;px=999" role="button" title="db.png" alt="db.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 15 Feb 2021 08:37:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311492#M224687</guid>
      <dc:creator>BerniHacker</dc:creator>
      <dc:date>2021-02-15T08:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Error when copying CSV files from Windows directory into SQL Server DB by using Apache NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311515#M224703</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/85508"&gt;@BerniHacker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I see the cause could be different column names and in the &lt;STRONG&gt;PutDatabaseRecord&lt;/STRONG&gt; the option "Unmatched Column Behavior" is set to "Fail on Unmatched Columns".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose the options concerning "Unmatched Field Behavior" or "Unmatched Column Behavior" in connection with "Translate Field Names" causing your problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps you like to post your schema-definition?&lt;BR /&gt;But at the moment I can't give you a concreter answer.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 06:47:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311515#M224703</guid>
      <dc:creator>justenji</dc:creator>
      <dc:date>2021-02-16T06:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Error when copying CSV files from Windows directory into SQL Server DB by using Apache NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311516#M224704</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/85508"&gt;@BerniHacker&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Sorry, my reply was not good.&lt;BR /&gt;Did not see that you are working with "Use String Fields From Header" and not a separate schema.&lt;BR /&gt;I will try to get it work on my local installation.&lt;BR /&gt;If you found a solution by so kind to let us know. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 07:11:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311516#M224704</guid>
      <dc:creator>justenji</dc:creator>
      <dc:date>2021-02-16T07:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error when copying CSV files from Windows directory into SQL Server DB by using Apache NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311517#M224705</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/67599"&gt;@justenji&lt;/a&gt;Thanks a lot for offering your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am really stuck with this. I tried many different things (for example, table name = dbo.alpha, CSV Format = Customer Format, ...), always with same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I changed Unmatched Column Behaviour (Unmatched Column Behaviour = Ignore Unmatched Columns). Again same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried with xlsx files by using a ConvertExcelToCSVProcessor in the middle. Same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 08:47:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311517#M224705</guid>
      <dc:creator>BerniHacker</dc:creator>
      <dc:date>2021-02-16T08:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error when copying CSV files from Windows directory into SQL Server DB by using Apache NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311560#M224729</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/85508"&gt;@BerniHacker&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The whole day I couldn't achive to work on this further. Now I found a solution but at the moment I can't document this detailed because "work is calling".&lt;BR /&gt;&lt;BR /&gt;In small words:&lt;BR /&gt;GetFile -&amp;gt; UpdateAttribute (to set NiFi-attribute schema.name) -&amp;gt; PutDatabaseRecord (with CSV-Record Reader)&lt;BR /&gt;BUT the reader has to use a schema which is defined in the controller services as AvroSchemaRegistry and there has to exist a avro schema for the structure.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Maybe this will help you further.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a look here &lt;A href="https://community.cloudera.com/t5/Support-Questions/Loading-a-simple-CSV-file-using-nifi-PutDatabaseRecord-and/td-p/222678" target="_blank"&gt;https://community.cloudera.com/t5/Support-Questions/Loading-a-simple-CSV-file-using-nifi-PutDatabaseRecord-and/td-p/222678&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Tomorrow I will describe my solution detailed! Sorry...&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 17:13:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311560#M224729</guid>
      <dc:creator>justenji</dc:creator>
      <dc:date>2021-02-16T17:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Error when copying CSV files from Windows directory into SQL Server DB by using Apache NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311569#M224730</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/85508"&gt;@BerniHacker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Come on work can wait...&lt;/P&gt;&lt;P&gt;Here my description with NiFi 1.12.1. on a windows standalone installation.&lt;BR /&gt;&lt;BR /&gt;This is my test csv.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;id;title;first;last
1;miss;marlene;shaw
2;ms;letitia;jordan
3;mr;todd;graham
4;mr;seth;martinez
5;mr;guy;mckinney
6;ms;anna;smith
7;mr;johnny;johnson
8;mrs;robin;white
9;miss;allison;williams
10;mrs;erika;king&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my flow:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Flow" style="width: 833px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30409iE17C488762884C12/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-02-17_HCC_1_Flow.png" alt="Flow" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Flow&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my sql table.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SQL table" style="width: 618px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30410iC942CED87AEB620F/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-02-17_HCC_5_SQLTable.png" alt="SQL table" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;SQL table&lt;/span&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This is the configuration of the csv-reader.&lt;BR /&gt;Note the green bordered information!&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Controller Service - dsv reader" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30411i84313557A63DDF0D/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-02-17_HCC_3_CSVReader.png" alt="Controller Service - dsv reader" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Controller Service - dsv reader&lt;/span&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;The schema has to be defined in a controller service of the type "&lt;SPAN&gt;AvroSchemaRegistry&lt;/SPAN&gt;".&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AvroSchemaRegistry" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30412iAA4974A6BB140156/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-02-17_HCC_2_AvroSchemaRegistry.png" alt="AvroSchemaRegistry" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;AvroSchemaRegistry&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the UpdateAttribute you set the NiFi-attribute&amp;nbsp; &amp;nbsp;schema.name&amp;nbsp; to the concrete schema you use.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="UpdateAttribute schema.name" style="width: 872px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30413iF6F23AE42786F384/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-02-17_HCC_4_UpdateAttribute.png" alt="UpdateAttribute schema.name" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;UpdateAttribute schema.name&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And last but not least configure the PutDatabaseRecord.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PutDatabaseRecord" style="width: 971px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30414iE17BD8F7D7BD6263/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-02-17_HCC_6_PutDatabaseRecord.png" alt="PutDatabaseRecord" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;PutDatabaseRecord&lt;/span&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Here is the result in my sql table.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SQL Result" style="width: 525px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30415i49B5C8FEE19B1802/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-02-17_HCC_7_SQLContent.png" alt="SQL Result" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;SQL Result&lt;/span&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps and works for you. Bye!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 17:40:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311569#M224730</guid>
      <dc:creator>justenji</dc:creator>
      <dc:date>2021-02-16T17:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error when copying CSV files from Windows directory into SQL Server DB by using Apache NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311614#M224758</link>
      <description>&lt;P&gt;&lt;A href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/67599" target="_blank"&gt;@justenji&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot! The suggestion you proposed works great!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the source of the problem was not a lack of schema definition. In fact, I managed also to have a working flow with the option Schema Access Strategy = Use String Fields From Header in the CSVReader processor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The warning "None of the fields in the record map to the columns defined by the &lt;EM&gt;tablename&lt;/EM&gt; table." is also obtained when the processor is not able to find the table and this can happen also when the table name is correctly configured in PutDatabaseRecord but there is some issue with user access rights (which ended up to be the actual cause of my error ...).&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 13:35:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Error-when-copying-CSV-files-from-Windows-directory-into-SQL/m-p/311614#M224758</guid>
      <dc:creator>BerniHacker</dc:creator>
      <dc:date>2021-02-17T13:35:34Z</dc:date>
    </item>
  </channel>
</rss>

