cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Last file in S3 folder using autoloader

Miguel_Salas
New Contributor II

Nowadays we already use the autoloader with checkpoint location, but I still wanted to know if it is possible to read only the last updated file within a folder. I know it somewhat loses the purpose of checkpoint locatio
Another question is it possible to obtain any information if the autoloader returns an empty dataframe without having to run a count on the dataframe? Some parameter of how many files or mb were read.

1 REPLY 1

Kaniz_Fatma
Community Manager
Community Manager

Hi @Miguel_SalasWhile the primary purpose of using Auto Loader with checkpointing is to process new files incrementally, you can still achieve reading only the last updated file within a folder. One approach is to use the cloudFiles.includeExistingFiles option set to true and then filter the files based on their modification timestamp. This way, you can identify and process only the most recently updated file.

To obtain information when Auto Loader returns an empty DataFrame without running a count, you can use the cloudFiles options to get metadata about the files processed. Specifically, the cloudFiles.maxBytesPerTrigger and cloudFiles.maxFilesPerTrigger options can help y.... Additionally, you can monitor the streaming queryโ€™s progress to get insights into the number of files processed.

Would you like more details on configuring these options?

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group