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: 

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
Databricks Employee
Databricks Employee

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!

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