On 20 Oct, 15:48, Chris Withers <ch...@simplistix.co.uk> 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.now() - timedelta
> > (days = 30)).delete()
>
> Yep, that's prettymuch what I ended up writing. Wow, Django's ORM
> expressions are ugly compared to SQLAlchemy ;-)
>
Then just
import sqlalchemy
Don't do URL whacking. Just write a simple management command and wire
that to your crontab.
If the db is a legacy database and things are stored as varchars then
I don't see any point in changing the database so you can use proper
datetimes.
And if it's indexed searching for something like 'April 2009' is going
to be uber fast.
> > old. As for your complicated references, assuming you don't have
> > cascading deletes happening automatically, you may have to do an
> > objects.filter(),
>
> Well, cascading deletes do happen automatically with Django, so no
> problem there...
>
> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
> -http://www.simplistix.co.uk
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---