Using raw SQL in django

For a django project I’m working on, I need to run a simple query with COUNT and GROUP BY statements to collect some summary data. I tried working with the model API, and eventually fell back to using raw SQL instead. Here’s the query I wanted to run: SELECT(year/10)*10asdecade,count(*)ascase_countFROMdocket_caseGROUPBYdecadeOne problem I encountered was there was no way (that I could find) to do a GROUP BY. I found one reference to a group_by() method, but I don’t think the patch has been submitted or approved.

Book Review: The Definitive Guide to Django

I’m working on a new web-based project, and continuing the process of learning django, so I was very pleased to receive my copy of The Definitive Guide to django by Adrian Holovaty and Jacob Kaplan-Moss in the mail recently. Contents The book is divided into 3 sections. The first, including chapters 1-8, covers introductory material such as setting up a project, using the template system and database layer, etc. This was familiar material after several readings of the tutorials on the django web site, but it has been cleaned up and organized nicely in the book.

Python Magazine for December available for download now

The December issue of Python Magazine went live this morning. If you’re a subscriber, you can download your personalized, DRM-free PDF via your account page right away. Contents: The cover story this month is Python Threads and the Global Interpreter Lock, a detailed analysis of threading performance under different types of load by Jesse Noller. Jesse’s article is chock-full of benchmarks and background material that illustrates when the GIL is, and isn’t, an issue.

PyMOTW: zipimport

The zipimport module can be used to import and run Python code found inside ZIP archives. Read more at pymotw.com: zipimport

This Week in Django – Podcast

If you haven’t already seen it, check out Michael Trier’s new podcast “This Week in Django”. The first episode was good, so I’m looking forward to listening to the second. Subscribed!

Adam Gomaa explains why I prefer Django to Turbo Gears

I’ve built a couple of small web projects using Turbo Gears and Django. I found the Django experience much nicer, in the end, and am sticking with it for now. My main beef with Turbo Gears is that to figure out how to do anything I had to visit 3-4 different web sites to read documentation for the different pieces. The larger problem, as Adam Gomaa points out in his post about Pylons and Django, is that Turbo Gears lacked conceptual integrity.

new statistics package for python: python-statlib

One of the tasks for the Google Highly Open Participation contest was to combine several existing statistics modules into a single package to make it easier to install them. That work is done, and now available from python-statlib or via easy_install statlib. So that’s a whole new package created as a result the contest. I can’t get over how much work these students are doing!

PyMOTW: zipfile

The zipfile module can be used to manipulate ZIP archive files. Read more at pymotw.com: zipfile

two new releases

I’m working on another django project and need some head features for it, so I needed to update my server from 0.96 to use an svn checkout (I wish there were more frequent formal releases of django – they need a release manager). As a result, I spent a while today updating a couple of my applications to be compatible with the head version. So, there are new (formally tested and released :-) versions of django-links and codehosting available.