Azure synapse serverless query partitioned parquet using openrowset

sakuraime 2,321 Reputation points
2021-12-15T13:29:09.12+00:00

My parquet files are partitioned in Azure blob storage like in

path/year=/month=/

so I am able to do

select * from openrowset (BULK '/path/year=/month=/' ,DATA_SOURCE ='mysource',FORMAT = 'PARQUET') as files

I can do

select * from openrowset (BULK '/path/year=2021/month=1/' ,DATA_SOURCE ='mysource',FORMAT = 'PARQUET') as files

but I can't do

select * from openrowset (BULK '/path/year=2021/month={1,2}/' ,DATA_SOURCE ='mysource',FORMAT = 'PARQUET') as files

what's the correct syntax to do that to select multiple partitions in the open rowset ?

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.
4,402 questions
0 comments No comments
{count} votes

Accepted answer
  1. PRADEEPCHEEKATLA-MSFT 77,901 Reputation points Microsoft Employee
    2021-12-16T09:18:31.963+00:00

    Hello @sakuraime ,

    Thanks for the question and using MS Q&A platform.

    For the demo purpose, I had created sample folder structure as per your requirement:

    158449-dataimage.jpeg

    Here is the query to read subset of files in folder using multiple file paths option:

    158521-queryimage.jpeg

    For more details, refer to Read subset of files in folder using multiple file paths.

    Azure Synapse Serverless SQL pool supports reading multiple files/folders by using wildcards, which are similar to the wildcards used in Windows OS. However, greater flexibility is present since multiple wildcards are allowed.

    Note: All files accessed with the single OPENROWSET must have the same structure (i.e., number of columns and their data types).

    In this article - Query folders and multiple files, you'll learn how to write a query using serverless SQL pool in Azure Synapse Analytics.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

0 additional answers

Sort by: Most helpful