Share via

Querying with Filename and Filepath Functions in Synapse Serverless

Karl Gardner 85 Reputation points
2024-05-21T17:38:30.0266667+00:00

Hello,

I have been reading about using filename() and filepath() in t-sql statements with synapse serverless sql:

https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/query-specific-files#functions

Wondering if for the following statement: "The following sample reads the NYC Yellow Taxi data files for the last three months of 2017 and returns the number of rides per file.":

User's image

is the last three months of 2017 part not correct? Since the filepath says month=9 and their is no filtering wouldn't it only include the month of 9? This would also lead to the statement below that being incorrect as well:

"Your results will be the same as the prior example."

Thanks,

Karl Gardner

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.

Developer technologies | Transact-SQL
Developer technologies | Transact-SQL

A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.

0 comments No comments

Answer accepted by question author

Bhargava-MSFT 31,361 Reputation points Microsoft Employee Moderator
2024-05-21T19:43:51.3633333+00:00

Hi Karl Gardner,

Yes, you are correct. The filepath specified in the example BULK 'parquet/taxi/year=2017/month=9/*.parquet' will only include files from September 2017, not the last three months of 2017.

the description stating "The following sample reads the NYC Yellow Taxi data files for the last three months of 2017" is incorrect.

It should specify that it reads the data for only September 2017.

You can submit a GitHub item for this. Scroll down the page, and you will see the "This page" section. When you click on this, it will take you to the GitHub page and submit a Github item for this issue. The respective product groups will be notified and can correct this.

I hope this answers your question.

User's image

If this answers your question, please consider accepting the answer by hitting the Accept answer and up-vote as it helps the community look for answers to similar questions.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Karl Gardner 85 Reputation points
    2024-05-21T20:52:17.8666667+00:00

    Thank you!

    Was this answer helpful?

    0 comments No comments

Your answer

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