Re: Looking for a way to detect changes in database records with low storage footprint

2013-10-14 Thread DJ-Tom
Thanks, this might be a way to go - since the .extra() method may create a dependency on the SQL dialect used I will have to be careful though ;-) Am Donnerstag, 10. Oktober 2013 19:01:32 UTC+2 schrieb Tom Evans: > > This is not a full solution, but you can select out extra fields (and > then

Re: Looking for a way to detect changes in database records with low storage footprint

2013-10-10 Thread Tom Evans
On Thu, Oct 10, 2013 at 2:55 PM, DJ-Tom wrote: > > Thanks, but *how* can I create a hash from a database object in Django - is > there a generic method to iterate over all (or only specific) fields and get > a hash value? > This is not a full solution, but you can select

Re: Looking for a way to detect changes in database records with low storage footprint

2013-10-10 Thread C. Kirby
You could grab the __dict__ of the instance and use that. import hashlib hash = hashlib.md5() hash.update(str(MyModel.objects.get(pk = 1).__dict__)) hash.digest() On Thursday, October 10, 2013 8:55:27 AM UTC-5, DJ-Tom wrote: > > > Thanks, but *how* can I create a hash from a database object in

Re: Looking for a way to detect changes in database records with low storage footprint

2013-10-10 Thread DJ-Tom
Thanks, but *how* can I create a hash from a database object in Django - is there a generic method to iterate over all (or only specific) fields and get a hash value? Am Mittwoch, 9. Oktober 2013 19:07:54 UTC+2 schrieb Nikolas Stevenson-Molnar: > > A hash should work fine. Alternatively, you

Re: Looking for a way to detect changes in database records with low storage footprint

2013-10-09 Thread Nikolas Stevenson-Molnar
A hash should work fine. Alternatively, you could diff the two records, using something like difflib: http://docs.python.org/2/library/difflib.html _Nik On 10/9/2013 8:05 AM, DJ-Tom wrote: > Hi, > > a customer has requested a function to "compare" reports. > > So let's say I create a database

Looking for a way to detect changes in database records with low storage footprint

2013-10-09 Thread DJ-Tom
Hi, a customer has requested a function to "compare" reports. So let's say I create a database report on Monday, then the data is constantly changing the whole week and on the following Monday it should be possible to get a report that either contains only changed and new records or all