Re: efficiently deleting content based on how old it is

2009-10-27 Thread Chris Withers
Peter Bengtsson wrote: >> Yep, that's prettymuch what I ended up writing. Wow, Django's ORM >> expressions are ugly compared to SQLAlchemy ;-) >> > Then just > import sqlalchemy Yes, because that obviously provides a drop-in replacement for all users of Django's ORM ;-) > If the db is a legacy

Re: efficiently deleting content based on how old it is

2009-10-21 Thread Peter Bengtsson
On 20 Oct, 15:48, Chris Withers wrote: > Shawn Milochik wrote: > > I know this doesn't answer the hard part of your question, but here's   > > a simple way I delete old stuff from a database via an external script   > > that's run by cron: > > > Item.objects.filter(date_updated__lte = datetime.

Re: efficiently deleting content based on how old it is

2009-10-21 Thread David De La Harpe Golden
Jaime Buelta wrote: > When I had to do this kind of tasks, I've added a new management command and > run it from the cron (or manually any time you need it, with params, etc). > You can run it calling > > python manager.py miCommand parameters > "celery" may seem overkill initially, but works v

Re: efficiently deleting content based on how old it is

2009-10-20 Thread Jaime Buelta
When I had to do this kind of tasks, I've added a new management command and run it from the cron (or manually any time you need it, with params, etc). You can run it calling python manager.py miCommand parameters The official documentation is not very complete, which is rare, but there are some

Re: efficiently deleting content based on how old it is

2009-10-20 Thread Chris Withers
Shawn Milochik wrote: > I know this doesn't answer the hard part of your question, but here's > a simple way I delete old stuff from a database via an external script > that's run by cron: > > Item.objects.filter(date_updated__lte = datetime.now() - timedelta > (days = 30)).delete() Yep, th

Re: efficiently deleting content based on how old it is

2009-10-20 Thread Chris Withers
buttman wrote: > you could also do it this way: > > http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made-easy.html url whacking like that is pretty evil... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.

Re: efficiently deleting content based on how old it is

2009-10-11 Thread Sam Lai
2009/10/11 buttman : > > you could also do it this way: > > http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made-easy.html Is there really much point to this instead of just putting all that into a .py file and using cron to call the .py file instead? There doesn't seem to b

Re: efficiently deleting content based on how old it is

2009-10-10 Thread buttman
I'm the author. Are you sure the comments are broken? I just made one and it seemed to work. On Oct 10, 11:55 pm, Kenneth Gonsalves wrote: > On Sunday 11 Oct 2009 9:07:38 am buttman wrote: > > > you could also do it this way: > > >http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-dj

Re: efficiently deleting content based on how old it is

2009-10-10 Thread Kenneth Gonsalves
On Sunday 11 Oct 2009 9:07:38 am buttman wrote: > you could also do it this way: > > http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made- >easy.html interesting - but the author's commenting module is b0rked, so was unable to add a comment (I hope he sees this and sets it

Re: efficiently deleting content based on how old it is

2009-10-10 Thread buttman
you could also do it this way: http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made-easy.html On Oct 9, 5:56 am, Chris Withers wrote: > Streamweaver wrote: > > You could set this up as a custom manage.py command and run a cron on > > that.  Gives the advantage of both init

Re: efficiently deleting content based on how old it is

2009-10-10 Thread Shawn Milochik
Chris, I know this doesn't answer the hard part of your question, but here's a simple way I delete old stuff from a database via an external script that's run by cron: Item.objects.filter(date_updated__lte = datetime.now() - timedelta (days = 30)).delete() If you use timedelta, you can eas

Re: efficiently deleting content based on how old it is

2009-10-09 Thread Chris Withers
Streamweaver wrote: > You could set this up as a custom manage.py command and run a cron on > that. Gives the advantage of both initiating from outside the app and > using Django's DB abstraction layer. That's prettymuch what I was planning to do :-) > Then just iterate over the month names mor

Re: efficiently deleting content based on how old it is

2009-10-08 Thread Streamweaver
You could set this up as a custom manage.py command and run a cron on that. Gives the advantage of both initiating from outside the app and using Django's DB abstraction layer. A very simple way to do this would be to put all month text names in order in a tuple. i.e. monthnames = ('jan', 'feb

Re: efficiently deleting content based on how old it is

2009-10-08 Thread Chris Withers
Tim Chase wrote: > I wouldn't try to do it from within the web app itself -- > I'd schedule some wee-hours cron job to do the deletion. I plan to, don't worry ;-) But, I would like to do it from within the Django environment to make it immune to changes of database... > 6mo boundary. Your Mont

Re: efficiently deleting content based on how old it is

2009-10-08 Thread Tim Chase
> I only want to keep 6 months worth of data. How can I > efficiently delete a month and all it's associated > services and those services associated pages? (in this > app, there could be about 3 million pages that are > associated with each month though a bunch of service > objects) I woul