Delete datastore entities by their creation date

123 views
Skip to first unread message

A. Kong

unread,
Jul 13, 2015, 1:28:25 AM7/13/15
to google-a...@googlegroups.com
Hi all,

I have checked the ndb.Model api and there seems to no attribute to hold the creation timestamp of a data store entity.

It is my use case: I want to be able to define a cron job which will sweep  all entities in the datastore. If an entity is created say 24hours ago, it will be deleted. 

I can definitely add a 'creation_time' DateTimeProperty to my data model. However it would be neat if ndb supports this already

Cheers, Tony

Ryan (Cloud Platform Support)

unread,
Jul 13, 2015, 12:08:06 PM7/13/15
to google-a...@googlegroups.com, anthony...@gmail.com
Salutations,

This currently does not exist. You can file a Feature Request to add that functionality. In the mean time I would look at this link, specifically:

auto_now_addSet property to current date/time when entity is created.
auto_nowSet property to current date/time when entity is created and whenever it is updated.

Reply all
Reply to author
Forward
0 new messages