<?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: Cannot implement delta updates from upstream Postgres server behind gateway in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Cannot-implement-delta-updates-from-upstream-Postgres-server/m-p/4253166#M6012</link>
    <description>&lt;P&gt;Yes, I also found this thought manually defining datalake as Azure Sql Server&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then my activities pipeline looks like that&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Parametrisation of the query in the copy was very difficult to figure out, but throught searching browerstack etc. I came up with the following formula:&lt;/P&gt;&lt;PRE&gt;@concat('SELECT * FROM data.stockmaster', &lt;BR /&gt;if(or(equals(activity('stockmaster timestamp').status, 'Failed'), &lt;BR /&gt;equals(activity('stockmaster timestamp').output.firstRow.lastmodified, null)),&lt;BR /&gt;'',&lt;BR /&gt;concat(' WHERE lastmodified &amp;gt; ', '''', string(activity('stockmaster timestamp').output.firstRow.lastmodified), '''')))&lt;/PRE&gt;</description>
    <pubDate>Tue, 22 Oct 2024 21:49:53 GMT</pubDate>
    <dc:creator>silly_bird</dc:creator>
    <dc:date>2024-10-22T21:49:53Z</dc:date>
    <item>
      <title>Cannot implement delta updates from upstream Postgres server behind gateway</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Cannot-implement-delta-updates-from-upstream-Postgres-server/m-p/4251805#M6000</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got stuck with a simple task&lt;/P&gt;&lt;P&gt;I need to read from PostgresSQL that sits on prem behind gateways.&lt;/P&gt;&lt;P&gt;The gateway works for workflow and copy activity, but is not available in the notebook.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Postgres has some huge tables, I need to read only delta.&lt;/P&gt;&lt;P&gt;I need to lookup max recorded timestamp of the target table, read records after the timestamp from the source table, merge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I prefer to merge data into Lakehouse table, that will be my bronse layer.&lt;/P&gt;&lt;P&gt;Sadly I can't find how to achieve this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried &lt;STRONG&gt;pipeline.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;First, I need lookup the latest timestamp.&lt;/P&gt;&lt;P&gt;I tried script.&amp;nbsp; It&amp;nbsp;&lt;SPAN&gt;does not apply to the datalake source&amp;nbsp;(regarless it has an SQL endpoint !?!)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;so I employed a "lookup" activity.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I tried to play with "add dynamic context" and apply function "max"&lt;/P&gt;&lt;P&gt;This is from the documentation:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Is this use case is for people who can't figure which one of harcoded values are bigger and need to employ a function over them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't figure how to apply this to a column.&lt;/P&gt;&lt;P&gt;If anyone knows how to do that please help!&lt;/P&gt;&lt;P&gt;Also, I'm very much concerned about performance. Is it going to load the terrabyte table to memory to calculate max of the column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next, &lt;STRONG&gt;Spark&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Spark can't read from gatewayed sources.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, I tred a &lt;STRONG&gt;dataflow gen2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First query selects max state.&lt;/P&gt;&lt;P&gt;Send use it as a filter.&lt;/P&gt;&lt;P&gt;So far no luck&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; Source = Sql.Database(&lt;/SPAN&gt;&lt;SPAN&gt;"&amp;lt;&amp;gt;.datawarehouse.fabric.microsoft.com"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"my_staging_lakehouse"&lt;/SPAN&gt;&lt;SPAN&gt;, [Query = &lt;/SPAN&gt;&lt;SPAN&gt;"SELECT max(lastmodifiedutc) as lastmodifiedutc FROM state"&lt;/SPAN&gt;&lt;SPAN&gt;]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; #"Converted to list" = Source[lastmodifiedutc],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; #"lastmodifiedutc" = List.Max(#"lastmodifiedutc")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; #"lastmodifiedutc"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--2nd step--&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;let&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; Source = PostgreSQL.Database(&lt;/SPAN&gt;&lt;SPAN&gt;"&amp;lt;&amp;gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&amp;lt;&amp;gt;"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; #"Navigation 1" = Source{[Schema = &lt;/SPAN&gt;&lt;SPAN&gt;"data"&lt;/SPAN&gt;&lt;SPAN&gt;, Item = &lt;/SPAN&gt;&lt;SPAN&gt;"state"&lt;/SPAN&gt;&lt;SPAN&gt;]}[Data],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; #"Filtered rows" = Table.SelectRows(#"Navigation 1", &lt;/SPAN&gt;&lt;SPAN&gt;each&lt;/SPAN&gt;&lt;SPAN&gt; [lastmodified] &amp;gt; #"state"{&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;}[lastmodifiedutc])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; #"Filtered rows"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help figuring how to use result of the previous query in a filter of the next one please!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 22 Oct 2024 03:12:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Cannot-implement-delta-updates-from-upstream-Postgres-server/m-p/4251805#M6000</guid>
      <dc:creator>silly_bird</dc:creator>
      <dc:date>2024-10-22T03:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot implement delta updates from upstream Postgres server behind gateway</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Cannot-implement-delta-updates-from-upstream-Postgres-server/m-p/4252014#M6002</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="828704" data-lia-user-login="silly_bird" class="lia-mention lia-mention-user"&gt;silly_bird&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get the MAX value of a column, you could use the lookup activity in combination with a sql server connection. As I can see in your screenshots, you have a lakehouse connection defined. Instead of defining a lakehouse connection, you should set up a sql server connection and use the sql endpoint from the lakehouse in the settings. If you have a sql server connection, you are able to query the table in the lookup activity. In that query, you can directly take the MAX value within your select statement. In the next steps of the data pipeline, you can use the queried max value.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 06:36:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Cannot-implement-delta-updates-from-upstream-Postgres-server/m-p/4252014#M6002</guid>
      <dc:creator>FabianSchut</dc:creator>
      <dc:date>2024-10-22T06:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot implement delta updates from upstream Postgres server behind gateway</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Cannot-implement-delta-updates-from-upstream-Postgres-server/m-p/4253166#M6012</link>
      <description>&lt;P&gt;Yes, I also found this thought manually defining datalake as Azure Sql Server&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then my activities pipeline looks like that&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Parametrisation of the query in the copy was very difficult to figure out, but throught searching browerstack etc. I came up with the following formula:&lt;/P&gt;&lt;PRE&gt;@concat('SELECT * FROM data.stockmaster', &lt;BR /&gt;if(or(equals(activity('stockmaster timestamp').status, 'Failed'), &lt;BR /&gt;equals(activity('stockmaster timestamp').output.firstRow.lastmodified, null)),&lt;BR /&gt;'',&lt;BR /&gt;concat(' WHERE lastmodified &amp;gt; ', '''', string(activity('stockmaster timestamp').output.firstRow.lastmodified), '''')))&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Oct 2024 21:49:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Cannot-implement-delta-updates-from-upstream-Postgres-server/m-p/4253166#M6012</guid>
      <dc:creator>silly_bird</dc:creator>
      <dc:date>2024-10-22T21:49:53Z</dc:date>
    </item>
  </channel>
</rss>

