<?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: How to inject non-literal values in &amp;quot;table_changes&amp;quot; CDF function? in Warehousing &amp; Analytics</title>
    <link>https://community.databricks.com/t5/warehousing-analytics/how-to-inject-non-literal-values-in-quot-table-changes-quot-cdf/m-p/140749#M2388</link>
    <description>&lt;P&gt;What's worked for us is to use a string variable to construct the query and then use EXECUTE IMMEDIATE to execute the query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DECLARE OR REPLACE VAR QUERY;
SET VAR QUERY = 'SELECT * FROM TABLE_CHANGES("catalog.schema.table", "' || timestamp_start || '" , "' || timestamp_end || '")';
EXECUTE IMMEDIATE QUERY&lt;/LI-CODE&gt;&lt;P&gt;You can also put it in begin/end compound statement as well.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Dec 2025 13:46:24 GMT</pubDate>
    <dc:creator>iamgoce</dc:creator>
    <dc:date>2025-12-01T13:46:24Z</dc:date>
    <item>
      <title>How to inject non-literal values in "table_changes" CDF function?</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/how-to-inject-non-literal-values-in-quot-table-changes-quot-cdf/m-p/139118#M2352</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I am trying to use &lt;STRONG&gt;table_changes&lt;/STRONG&gt; CDF function in an &lt;STRONG&gt;external SQL function&lt;/STRONG&gt;&amp;nbsp;run it from an &lt;STRONG&gt;SQL Warehouse serverless cluster&lt;/STRONG&gt; in order to retrieve a set of changes from a given table. Here is the documentation for this fuunction:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/aws/en/sql/language-manual/functions/table_changes" target="_blank"&gt;https://docs.databricks.com/aws/en/sql/language-manual/functions/table_changes&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I'm facing the following issue:&lt;/P&gt;&lt;P&gt;- I would like to filter either "version from / version to" or "timestamp from / timestamp to" in a dynamic and automatic way, that is, &lt;STRONG&gt;without being forced to use literals&lt;/STRONG&gt;. All samples seem to be focused in working with this function in a kind of "manual" way where I need to retrieve minimum and maximum "versions" or "&lt;SPAN&gt;timestamps&lt;/SPAN&gt;" and then, apply those values as "literals", impossible to do it as "variables". If not possible to inject variables, any workaround for external SQL functions to narrow filters from the very beginning instead of doing it after getting results?&lt;/P&gt;&lt;P&gt;- Goal is to retrieve this information to be consumed by an API backend by hitting directly a SQL Warehouse serverless cluster via ODBC so usage of pyspark/sql notebooks in jobs is not a valid workaround for my business case.&lt;/P&gt;&lt;P&gt;Here is another feed with similar problem but not solved so far:&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/76415836/how-do-i-use-latest-version-in-table-changes-function-for-a-delta-table" target="_blank"&gt;https://stackoverflow.com/questions/76415836/how-do-i-use-latest-version-in-table-changes-function-for-a-delta-table&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Nov 2025 15:50:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/how-to-inject-non-literal-values-in-quot-table-changes-quot-cdf/m-p/139118#M2352</guid>
      <dc:creator>Coffee77</dc:creator>
      <dc:date>2025-11-14T15:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to inject non-literal values in "table_changes" CDF function?</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/how-to-inject-non-literal-values-in-quot-table-changes-quot-cdf/m-p/139119#M2353</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/179536"&gt;@Coffee77&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You cannot directly use SQL variables or subqueries in these arguments—they must be constants at parse time.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Nov 2025 16:03:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/how-to-inject-non-literal-values-in-quot-table-changes-quot-cdf/m-p/139119#M2353</guid>
      <dc:creator>saurabh18cs</dc:creator>
      <dc:date>2025-11-14T16:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to inject non-literal values in "table_changes" CDF function?</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/how-to-inject-non-literal-values-in-quot-table-changes-quot-cdf/m-p/139163#M2356</link>
      <description>&lt;P&gt;In the end, as a workaround I had to move/delegate the query to the .NET API backend. From API I can build the query in the exact way I need by previously processing filters, timestamps or versions, ending up with a similar code to the one displayed below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Coffee77_0-1763200404355.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/21722iD78F78594F57A296/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Coffee77_0-1763200404355.png" alt="Coffee77_0-1763200404355.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It would have been much better to make it with a central common Databricks SQL function but not possible so far.&lt;/P&gt;&lt;P&gt;KR&lt;/P&gt;</description>
      <pubDate>Sat, 15 Nov 2025 10:00:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/how-to-inject-non-literal-values-in-quot-table-changes-quot-cdf/m-p/139163#M2356</guid>
      <dc:creator>Coffee77</dc:creator>
      <dc:date>2025-11-15T10:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to inject non-literal values in "table_changes" CDF function?</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/how-to-inject-non-literal-values-in-quot-table-changes-quot-cdf/m-p/140749#M2388</link>
      <description>&lt;P&gt;What's worked for us is to use a string variable to construct the query and then use EXECUTE IMMEDIATE to execute the query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DECLARE OR REPLACE VAR QUERY;
SET VAR QUERY = 'SELECT * FROM TABLE_CHANGES("catalog.schema.table", "' || timestamp_start || '" , "' || timestamp_end || '")';
EXECUTE IMMEDIATE QUERY&lt;/LI-CODE&gt;&lt;P&gt;You can also put it in begin/end compound statement as well.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Dec 2025 13:46:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/how-to-inject-non-literal-values-in-quot-table-changes-quot-cdf/m-p/140749#M2388</guid>
      <dc:creator>iamgoce</dc:creator>
      <dc:date>2025-12-01T13:46:24Z</dc:date>
    </item>
  </channel>
</rss>

