<?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>topic Re: SQL query related to tDBInput (PostgreSQL) in Talend Data Catalog</title>
    <link>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322115#M2</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so, what is your question? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;btw:&lt;/P&gt;
&lt;P&gt;you always can prepare and test query with hardcoded schemas in the proper database tools - this step allows you to better understand errors. I use PyCharm, but any other could be used&lt;/P&gt;
&lt;P&gt;then, search and replace to prepare the final query (IF IT NECESSARY!!! )&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the main problem of this query - PostgreSQL does not allow join tables from different databases, you try to use 2 -&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;DW_ES_REQUEST_Database&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;DW_ES_COMMON_Database&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2019 11:54:27 GMT</pubDate>
    <dc:creator>vapukov</dc:creator>
    <dc:date>2019-07-24T11:54:27Z</dc:date>
    <item>
      <title>SQL query related to tDBInput (PostgreSQL)</title>
      <link>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322114#M1</link>
      <description>&lt;P&gt;Hi, I am using Talend to do a left outer join between two tables in a database, in fact, the query is too complicated and the concatenation is difficult to understand and adapt, please check with me the query pasted in the following lines:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;"SELECT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request.seq_day_tmp\",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;coalesce(\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request.seq_request_tmp,(SELECT \""+context.DW_ES_COMMON_Database+"\".\""+context.DW_ES_COMMON_Schema+"\".dim_request_scd.seq_request_scd FROM \""+context.DW_ES_COMMON_Database+"\".\""+context.DW_ES_COMMON_Schema+"\".\""+dim_request_scd\"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;WHERE \""+context.DW_ES_COMMON_Database+"\".\""+context.DW_ES_COMMON_Schema+"\".\""+dim_request_scd.seq_request=(select \""+context.DW_ES_COMMON_Database+"\".\""+context.DW_ES_COMMON_Schema+"\".\""+dim_request.seq_request from \""+context.DW_ES_COMMON_Database+"\".\""+context.DW_ES_COMMON_Schema+"\".\""+dim_request\"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;WHERE \""+context.DW_ES_COMMON_Database+"\".\""+context.DW_ES_COMMON_Schema+"\".\""+dim_request.cod_request='Non Renseigné'))) AS seq_request_tmp\",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request.seq_request_scd_tmp\",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request.seq_application_tmp\",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request.deadlines_taking_charges_tmp\",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request.deadlines_solving_tmp\",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request.deadlines_delivery_tmp\",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request.nb_resquest_tmp\",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request.flag_successeful_delivery_tmp\"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;FROM \""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request\"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;left outer join \""+context.DW_ES_COMMON_Database+"\".\""+context.DW_ES_COMMON_Schema+"\".\""+dim_request_scd\"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;on \""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+tmp_request.seq_request_tmp=\""+context.DW_ES_COMMON_Database+"\".\""+context.DW_ES_COMMON_Schema+"\".\""+dim_request_scd.seq_request\"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;and (\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+dim_request_scd.dat_begin = null or (select CURRENT_DATE)&amp;gt;=\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+dim_request_scd.dat_begin)\" &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="1 2 3 4 5 6 7"&gt;and (\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+dim_request_scd.dat_end = null or (select CURRENT_DATE)&amp;lt;\""+context.DW_ES_REQUEST_Database+"\".\""+context.DW_ES_REQUEST_Schema+"\".\""+dim_request_scd.dat_end);"&lt;/FONT&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 423px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6cl.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/136309i7F9D85AC97476E93/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6cl.png" alt="0683p000009M6cl.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:11:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322114#M1</guid>
      <dc:creator>Hajar1</dc:creator>
      <dc:date>2024-11-16T05:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query related to tDBInput (PostgreSQL)</title>
      <link>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322115#M2</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so, what is your question? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;btw:&lt;/P&gt;
&lt;P&gt;you always can prepare and test query with hardcoded schemas in the proper database tools - this step allows you to better understand errors. I use PyCharm, but any other could be used&lt;/P&gt;
&lt;P&gt;then, search and replace to prepare the final query (IF IT NECESSARY!!! )&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the main problem of this query - PostgreSQL does not allow join tables from different databases, you try to use 2 -&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;DW_ES_REQUEST_Database&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;DW_ES_COMMON_Database&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 11:54:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322115#M2</guid>
      <dc:creator>vapukov</dc:creator>
      <dc:date>2019-07-24T11:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query related to tDBInput (PostgreSQL)</title>
      <link>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322116#M3</link>
      <description>&lt;P&gt;Thank you for your answer, in fact, I tried to execute the query in HeidiSQL, and it was fine, my question is how to correct this query to be well compiled in Talend Open Studio. The following image shows the original query and its execution in HeidiSQL.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6m1.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138469i4870884CCD9875F8/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6m1.png" alt="0683p000009M6m1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 12:41:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322116#M3</guid>
      <dc:creator>Hajar1</dc:creator>
      <dc:date>2019-07-24T12:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query related to tDBInput (PostgreSQL)</title>
      <link>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322117#M4</link>
      <description>&lt;P&gt;as you can see from your screenshot - in working query you use 1 nested level - same database, different schemas,&lt;STRONG&gt; SCHEMA -&amp;gt; TABLE&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;but in Talend - you try to use different databases - &lt;STRONG&gt;DATABASE - &amp;gt; SCHEMA -&amp;gt; TABLE&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;this is a source of error&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;for reduce number of contatenations:&lt;/P&gt; 
&lt;P&gt;- because connection settings contain the schema, you can exclude schema for tables from current schema, and use context.schema only for 2nd&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;ADD:&lt;/P&gt; 
&lt;P&gt;in most of cases - you can use query as-is in your editor, if you do not plan rename schemas&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 12:48:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322117#M4</guid>
      <dc:creator>vapukov</dc:creator>
      <dc:date>2019-07-24T12:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query related to tDBInput (PostgreSQL)</title>
      <link>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322118#M5</link>
      <description>&lt;P&gt;Thanks for your answer, I will try this option, have a good day&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 14:52:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Data-Catalog/SQL-query-related-to-tDBInput-PostgreSQL/m-p/2322118#M5</guid>
      <dc:creator>Hajar1</dc:creator>
      <dc:date>2019-07-24T14:52:02Z</dc:date>
    </item>
  </channel>
</rss>

