[Baypiggies] How to store versioned objects

Jason Culverhouse jason at mischievous.org
Fri Apr 15 20:19:21 CEST 2011


On Apr 15, 2011, at 11:02 AM, Tung Wai Yip wrote:

> Not having much experience myself but it sounds like you want to look at temporal database.
> 
> http://en.wikipedia.org/wiki/Temporal_database
> 
> 
> Wai Yip
> 
> 
> On Fri, 15 Apr 2011 10:38:51 -0700, Max Slimmer <max at theslimmers.net> wrote:
> 
>> I have an application where the user creates and saves business
>> objects in a database. The objects are like invoices, header and
>> detail lines possibly some other attachments. When the object is saved
>> I want to create a version, and then should the user make changes I
>> would save these as a subsequent version such that when I retrieve the
>> object I normally get the latest version (along with some version id).
>> If the user desires he can get a specific previous version or see
>> history of changes including by who and when they were made.  Keep in
>> mind that these objects are not very large, like an invoice :-).
>> 
>> Do you know of any libraries that might help with this. I suppose I
>> could use some version control system and a mechanism to name the
>> object and possibly store some of the meta data in db.

You may not be using Django but you might look at django-reversion https://github.com/etianen/django-reversion to get some ideas.
It basically just pickles the row into JSON in a shadow table.  This doesn't help you "query" old data but it does protect you from schema migration which could get quite complicated if you alter the tables that you are versioning.

Jason

>> 
>> Thanks,
>> 
>> max
>> _______________________________________________
>> Baypiggies mailing list
>> Baypiggies at python.org
>> To change your subscription options or unsubscribe:
>> http://mail.python.org/mailman/listinfo/baypiggies
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies



More information about the Baypiggies mailing list