cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Get last modified date or create date for azure blob container

AlaQabaja
New Contributor II

Hi Everyone,

I am trying to implement a way in Python to only read files that weren't loaded since the last run of my notebook. The way I am thinking of implementing this is to keep of the last time my notebook has finished in a database table. Next time my job runs, I would like to only load the net new files that were added to azure blob. So, I want to be able to read the create date or last modified date for that file for me to be able to do incremental loading.

My two questions are:

- Am I doing it the right way?

- Is it possible to get create date and/or modified date of an azure blob container using Python?

3 REPLIES 3

shyam_9
Valued Contributor
Valued Contributor

Hi @Ala Qabaja,

For Getting last modified date in azure blob container use below code,

DateTime date =DateTime.Now;using(var filestream =File.OpenRead(@"D:\test.txt")){
               block.UploadFromStream(filestream);
               block.Metadata["lastmodifydate"]= date.ToString();
               block.SetMetadata();}
           block.FetchAttributes();string dateInfo= block.Metadata["lastmodifydate"];

AlaQabaja
New Contributor II

Thanks for your response. I am not sure what your code is and how to implement it. I am using PySpark and not using streams.

Forum_Admin
Contributor

Hello! I just wanted to share my point of view on the topic of dating sites. I have been looking for a decent Asian catch-up site for a very long time, in addition to them I found https://hookupsearch.org/asian-hookup-sites/. We definitely recommend this to anyone who is going to date and date women from solid anodized dishes, because the platforms have everything you might need, as well as what you want!

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.