Show partitions query is not working in Azure synapse analytics for delta table

Harshil Shah 21 Reputation points
2022-06-28T11:02:36.063+00:00

I have created a delta table using the following query

create table test_delta_partition(id int, created_time date) PARTITIONED BY (created_time) using delta
And insert some records in that table.

When I try to execute the show partitions query I face the below issue

215717-image.png

can you pls give me any alternate approach list down partitions?

Thank you for the solutions.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,373 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Harshil Shah 21 Reputation points
    2022-07-20T04:36:20.373+00:00

    I got the solution for this issue:

    • First, we will get partitions columns using the below query:
      DESCRIBE DETAIL ${table_name}
    • After getting the columns we can use the distinct query. The syntax is below:
      SELECT DISTINCT COLUMN1,COLUMN2,... from ${table_name}

    After using the above SQL query we can get partition values from the table.

    In our example:
    first, we will do
    describe detail test_delta_partition

    So we get partition columns from the above query like below
    222535-image.png

    After that, we can use the distinct query and we get partition values:

    SELECT DISTINCT created_time from test_delta_partition;

    222562-image.png


  2. Srini Munagala 0 Reputation points
    2023-02-09T15:37:48.2+00:00

    What is the way of getting list of partitions of an external table without querying the table.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.