<?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 Use output of SHOW PARTITION commands in Sub-Query/CTE/Function in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/use-output-of-show-partition-commands-in-sub-query-cte-function/m-p/34788#M25507</link>
    <description>&lt;P&gt;I am using SHOW PARTITIONS &amp;lt;&amp;lt;table_name&amp;gt;&amp;gt; to get all the partitions of a table. I want to use max() on the output of this command to get the latest partition for the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am not able to use SHOW PARTITIONS &amp;lt;&amp;lt;table_name&amp;gt;&amp;gt; in a CTE/sub-query/table function. All of them fail with syntax error. Any inputs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;with t as (
SHOW PARTITIONS &amp;lt;&amp;lt;table_name&amp;gt;&amp;gt;
)
select * from t&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from (
SHOW PARTITIONS &amp;lt;&amp;lt;table_name&amp;gt;&amp;gt;
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Aug 2022 23:20:55 GMT</pubDate>
    <dc:creator>pshah83</dc:creator>
    <dc:date>2022-08-11T23:20:55Z</dc:date>
    <item>
      <title>Use output of SHOW PARTITION commands in Sub-Query/CTE/Function</title>
      <link>https://community.databricks.com/t5/data-engineering/use-output-of-show-partition-commands-in-sub-query-cte-function/m-p/34788#M25507</link>
      <description>&lt;P&gt;I am using SHOW PARTITIONS &amp;lt;&amp;lt;table_name&amp;gt;&amp;gt; to get all the partitions of a table. I want to use max() on the output of this command to get the latest partition for the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am not able to use SHOW PARTITIONS &amp;lt;&amp;lt;table_name&amp;gt;&amp;gt; in a CTE/sub-query/table function. All of them fail with syntax error. Any inputs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;with t as (
SHOW PARTITIONS &amp;lt;&amp;lt;table_name&amp;gt;&amp;gt;
)
select * from t&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from (
SHOW PARTITIONS &amp;lt;&amp;lt;table_name&amp;gt;&amp;gt;
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 23:20:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/use-output-of-show-partition-commands-in-sub-query-cte-function/m-p/34788#M25507</guid>
      <dc:creator>pshah83</dc:creator>
      <dc:date>2022-08-11T23:20:55Z</dc:date>
    </item>
  </channel>
</rss>

