question

sakuraime avatar image
0 Votes"
sakuraime asked SamaraSoucy-MSFT answered

Azure synapse serverless openrowset parquet

Suppose I have a parquet folder

table/year/month/*.parquet

and my query is

SELECT count()
FROM OPENROWSET(BULK '/path/table/2021/10/
.parquet',DATA_SOURCE='source',FORMAT = 'PARQUET')
AS a

the above is for one year and
what if I would like to do for two years 2021 and 2020 ? what's the syntax

SELECT count()
FROM OPENROWSET(BULK '/path/table/2021,2020/10/
.parquet',DATA_SOURCE='source',FORMAT = 'PARQUET')
AS a

azure-synapse-analytics
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SamaraSoucy-MSFT avatar image
0 Votes"
SamaraSoucy-MSFT answered

You can do this by using a combination of wildcard (*) and filepath() function:

 SELECT count()
 FROM OPENROWSET(BULK '/path/table/202*/10/.parquet',DATA_SOURCE='source',FORMAT = 'PARQUET')
 AS a
 WHERE
     a.filepath(3) IN (2020,2021)


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.