<?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 Using multiple tables in nifi querydatabasetable custom query in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Using-multiple-tables-in-nifi-querydatabasetable-custom/m-p/351635#M236322</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am using a QueryDatabase Table processor to get data from Oracle database to transfer data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I use custom query like below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Both table_a and table_b has incremental columns that I can use for maximum-value columns.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My question is, can we track changes from both tables in a single&amp;nbsp;&amp;nbsp;QueryDatabase processor.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When any column from table_a or table_b changes, I want to transfer below query result to another Oracle database.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Select a.column_1, a.column_2, a.column_3, b.column_1, b.column_2, b.column_3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;from table_a a table_b b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;where a.id=b.id&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Sep 2022 17:02:00 GMT</pubDate>
    <dc:creator>data_tr</dc:creator>
    <dc:date>2022-09-06T17:02:00Z</dc:date>
    <item>
      <title>Using multiple tables in nifi querydatabasetable custom query</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Using-multiple-tables-in-nifi-querydatabasetable-custom/m-p/351635#M236322</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am using a QueryDatabase Table processor to get data from Oracle database to transfer data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I use custom query like below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Both table_a and table_b has incremental columns that I can use for maximum-value columns.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My question is, can we track changes from both tables in a single&amp;nbsp;&amp;nbsp;QueryDatabase processor.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When any column from table_a or table_b changes, I want to transfer below query result to another Oracle database.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Select a.column_1, a.column_2, a.column_3, b.column_1, b.column_2, b.column_3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;from table_a a table_b b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;where a.id=b.id&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 17:02:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Using-multiple-tables-in-nifi-querydatabasetable-custom/m-p/351635#M236322</guid>
      <dc:creator>data_tr</dc:creator>
      <dc:date>2022-09-06T17:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using multiple tables in nifi querydatabasetable custom query</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Using-multiple-tables-in-nifi-querydatabasetable-custom/m-p/351652#M236325</link>
      <description>&lt;P&gt;If you have access to the Oracle Db, create a View for your query on that DB. Then use the View name as Db name inside&amp;nbsp;&lt;SPAN&gt;QueryDatabaseTable.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;NOTE: If you have complex query, do use View instead.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 20:20:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Using-multiple-tables-in-nifi-querydatabasetable-custom/m-p/351652#M236325</guid>
      <dc:creator>rafy</dc:creator>
      <dc:date>2022-09-06T20:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using multiple tables in nifi querydatabasetable custom query</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Using-multiple-tables-in-nifi-querydatabasetable-custom/m-p/351655#M236327</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The example query you have shown would work id you add a JOIN statement. This would allow you to select all the records where either of the incremental value columns has changed. For example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;select&lt;/STRONG&gt;&lt;/SPAN&gt; a&lt;SPAN class="s2"&gt;.&lt;/SPAN&gt;column_1&lt;SPAN class="s2"&gt;, &lt;/SPAN&gt;a&lt;SPAN class="s2"&gt;.&lt;/SPAN&gt;&lt;SPAN class="s3"&gt;column_2&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;, &lt;/SPAN&gt;a&lt;SPAN class="s2"&gt;.&lt;/SPAN&gt;column_3&lt;SPAN class="s2"&gt;, &lt;/SPAN&gt;b&lt;SPAN class="s2"&gt;.&lt;/SPAN&gt;column_1&lt;SPAN class="s2"&gt;, &lt;/SPAN&gt;b&lt;SPAN class="s2"&gt;.&lt;/SPAN&gt;column_2&lt;SPAN class="s2"&gt;, &lt;/SPAN&gt;b&lt;SPAN class="s2"&gt;.&lt;/SPAN&gt;column_3&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;from&lt;/STRONG&gt;&lt;/SPAN&gt; table_a a&lt;SPAN class="s2"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;join&lt;/STRONG&gt;&lt;/SPAN&gt; table_b b &lt;SPAN class="s1"&gt;&lt;STRONG&gt;on&lt;/STRONG&gt;&lt;/SPAN&gt; a&lt;SPAN class="s2"&gt;.&lt;/SPAN&gt;id&lt;SPAN class="s2"&gt; = &lt;/SPAN&gt;b&lt;SPAN class="s2"&gt;.&lt;/SPAN&gt;id&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;where&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;a&lt;/SPAN&gt;.&lt;SPAN class="s4"&gt;id&lt;/SPAN&gt; &amp;gt; &lt;SPAN class="s5"&gt;2&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;&lt;STRONG&gt;or&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;b&lt;/SPAN&gt;.&lt;SPAN class="s4"&gt;id&lt;/SPAN&gt; &amp;gt; &lt;SPAN class="s5"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The trouble with this is you're not really tracking changes and you risk getting duplicate records unless both table_a and table_b are updated at the same time. If they are updated simultaneously then it ought to be sufficient to track the changes in only one table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you really want to track changes to tables in a relational database you might want to consider using the CDC processor. There was a series of tutorial posts previously published on how to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/t5/Community-Articles/Change-Data-Capture-CDC-with-Apache-NiFi-Part-1-of-3/ta-p/246623" target="_blank"&gt;https://community.cloudera.com/t5/Community-Articles/Change-Data-Capture-CDC-with-Apache-NiFi-Part-1-of-3/ta-p/246623&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 20:43:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Using-multiple-tables-in-nifi-querydatabasetable-custom/m-p/351655#M236327</guid>
      <dc:creator>JimHalfpenny</dc:creator>
      <dc:date>2022-09-06T20:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using multiple tables in nifi querydatabasetable custom query</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Using-multiple-tables-in-nifi-querydatabasetable-custom/m-p/351766#M236365</link>
      <description>&lt;P&gt;Thanks for your reply,&lt;/P&gt;&lt;P&gt;I checked CDC processor but it is specific to MySQL db. My source db is Oracle.&lt;/P&gt;&lt;P&gt;ID is not the incremental column in the tables. There is a modifiedtime column in both table_a and table_b that shows the updated time of the row. For now I used modifiedtime column in table_a as&amp;nbsp;&lt;SPAN&gt;Maximum-value Columns in QueryDatabase processor, but when modifiedtime column updated on table_b (eg. column_1 table value updated in table_b) I can't track the change in this table. Should I use another&amp;nbsp;QueryDatabase processor and set&amp;nbsp;modifiedtime column in table_b as&amp;nbsp;Maximum-value Columns?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 11:08:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Using-multiple-tables-in-nifi-querydatabasetable-custom/m-p/351766#M236365</guid>
      <dc:creator>data_tr</dc:creator>
      <dc:date>2022-09-08T11:08:26Z</dc:date>
    </item>
  </channel>
</rss>

