<?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: Why do ExecuteSQLRecord and CSVRecordSetWriter updated the time zone of datetime values? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/369319#M240462</link>
    <description>&lt;P&gt;Hello I have to ask how would you be able to convert CSV data into Mysql-Load-statement ?&lt;BR /&gt;because I can see that you are using a PutSql processor which directly needs SQL-query/Cmd.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Apr 2023 08:27:38 GMT</pubDate>
    <dc:creator>rohit2811</dc:creator>
    <dc:date>2023-04-25T08:27:38Z</dc:date>
    <item>
      <title>Why do ExecuteSQLRecord and CSVRecordSetWriter updated the time zone of datetime values?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/309065#M223757</link>
      <description>&lt;P&gt;Hello! I am new to NiFi. I hope someone here can advise me about my problem with time zone. I have these processors:&lt;/P&gt;&lt;P&gt;ListDatabaseTables -&amp;gt; GenerateTableFetch -&amp;gt; ExecuteSQLRecord (writing to csv file by CSVRecordWriter) -&amp;gt; ... ... PutSQL (loading csv file to MySQL using Load Data command)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The source DB is Oracle.&amp;nbsp;CSVRecordWriter has the following properties:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Schema Write Strategy -&amp;gt; Do Not Write Schema&lt;BR /&gt;Schema Access Strategy -&amp;gt; Inherit Record Schema&lt;BR /&gt;Schema Name -&amp;gt; ${schema.name}&lt;BR /&gt;Schema Text -&amp;gt; ${avro.schema}&lt;BR /&gt;Date Format -&amp;gt; yyyy-MM-dd&lt;BR /&gt;Time Format -&amp;gt; HH:mm:ss&lt;BR /&gt;Timestamp Format -&amp;gt; yyyy-MM-dd HH:mm:ss&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My source DB and the target DB are both in US east time zone. However, I noticed that the output of ExecuteSQLRecord having time values converted to UTC (added to 5 hours). That results in the wrong time values in the target DB. There may be some ways to convert each date/time column individually, but that will require a huge amount of development effort.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to handle this issue properly at global level, or at least at table level? Please note that&amp;nbsp;Time Format needs to be acceptable to MySQL Load Data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;Gary&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 20:20:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/309065#M223757</guid>
      <dc:creator>Garyy</dc:creator>
      <dc:date>2021-01-07T20:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why do ExecuteSQLRecord and CSVRecordSetWriter updated the time zone of datetime values?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/309628#M223880</link>
      <description>&lt;P&gt;I figured out a workaround myself and hope it's useful for others. I use the following query to generate another query to be executed by the next step. This query converts Oracle date values to the preferred strings at the global level so it save the development effort at column level or table level.&lt;/P&gt;&lt;P&gt;SELECT LISTAGG( CASE WHEN COLUMN_ID =1 THEN 'SELECT ' || CASE WHEN DATA_TYPE IN ('DATE','TIMESTAMP') THEN 'TO_CHAR(' || COLUMN_NAME || ',''YYYY-MM-DD HH24:MI:SS'') AS ' || COLUMN_NAME ELSE COLUMN_NAME END ELSE CASE WHEN DATA_TYPE IN ('DATE','TIMESTAMP') THEN 'TO_CHAR(' || COLUMN_NAME || ',''YYYY-MM-DD HH24:MI:SS'') AS ' || COLUMN_NAME ELSE COLUMN_NAME END END ,',') WITHIN GROUP (ORDER BY COLUMN_ID) || ' FROM ' || '${db.table.name}' AS MY_RECORD&lt;BR /&gt;from user_tab_columns where table_name = '${db.table.name}' ;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 21:55:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/309628#M223880</guid>
      <dc:creator>Garyy</dc:creator>
      <dc:date>2021-01-13T21:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why do ExecuteSQLRecord and CSVRecordSetWriter updated the time zone of datetime values?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/369319#M240462</link>
      <description>&lt;P&gt;Hello I have to ask how would you be able to convert CSV data into Mysql-Load-statement ?&lt;BR /&gt;because I can see that you are using a PutSql processor which directly needs SQL-query/Cmd.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2023 08:27:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/369319#M240462</guid>
      <dc:creator>rohit2811</dc:creator>
      <dc:date>2023-04-25T08:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why do ExecuteSQLRecord and CSVRecordSetWriter updated the time zone of datetime values?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/369334#M240467</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/104773"&gt;@rohit2811&lt;/a&gt;&amp;nbsp;as this is an older post, you would have a better chance of receiving a resolution by&lt;A href="“https://community.cloudera.com/t5/forums/postpage/board-id/Questions”" target="_blank"&gt; starting a new thread&lt;/A&gt;. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2023 09:59:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/369334#M240467</guid>
      <dc:creator>VidyaSargur</dc:creator>
      <dc:date>2023-04-25T09:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why do ExecuteSQLRecord and CSVRecordSetWriter updated the time zone of datetime values?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/369346#M240471</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/104773"&gt;@rohit2811&lt;/a&gt;&amp;nbsp;When you have to figure out your own problem, like I did here, it could be painful. Fortunately, I received an email notification for the post that I totally forgot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I did was using PutFile to write the CSV flowfiles to the local system, then call PutSQL to execute your Load Data command to load the local csv files to your target DB.&lt;/P&gt;&lt;P&gt;I think there should be a processor to load data from flowfiles to the DB directly, but I failed to do so, not sure if NiFi has such as functionality. If anyone figures out how, please let me know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2023 14:25:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Why-do-ExecuteSQLRecord-and-CSVRecordSetWriter-updated-the/m-p/369346#M240471</guid>
      <dc:creator>Garyy</dc:creator>
      <dc:date>2023-04-25T14:25:26Z</dc:date>
    </item>
  </channel>
</rss>

