OT: Django 1.2 on track

A little off topic but I'm very pleased to see that the timetable for Django 1.2 seems to be holding since they just entered feature freeze with beta 1.

Among my favorite of features to come is, of course, support for multiple database backends. Other goodies are smart IF-tags in templates and template caching.

A PostgreSQL friendly way to load customized SQL in Django

So I finally came to a reasonable solution for problem with customized SQL loading in Django.

By creating a app manager to load the customized SQL (by using signal the post syncdb signal as suggested in #3214). This makes my customized SQL to be run after syncdb is done. (Avoiding the problem with customized SQL getting run after table creation but before index creation and initial data loading.)

This also means my customized SQL will be run as part of test suites avoiding customized SQL being wiped as described in #8792.

I actually made a patch to the load problem in #3214 before realizing the test would fail because of #8792 which made me abandon it. It is interesting to see the impact of the patch on Django 1.0.2 though:

$ svn diff | wc -l
$ svn st
M      django/db/backends/sqlite3/base.py
M      django/db/backends/__init__.py
M      django/db/backends/postgresql_psycopg2/base.py
M      django/core/management/sql.py
M      django/contrib/contenttypes/management.py
$ svn diff | wc -l

I wont bother anymore but I made it available available anyway: ticket-3214-patch-django-1.0.2.patch

Arbitrary SQL with Django and PostgreSQL caveat

Update:There's no work around other than mentioned in #3214. My previous suggestion was for a work around was false and a result of an error on my part. I have therefore edited the post to reflect this.

We haven't had the need for using arbitrary SQL in our application but this just changed when I was setting up automatic build and testing. I ran into a caveat: #3214. The title is somewhat misleading, the bug is really about the arbitrary SQL being mangled by Django without letting you know it.

It's all there in the ticket; dedicated developers, users needing it, patch, documentation and tests. And the reason for not accepting? Some backends doesn't handle multiple statement... I know SQLite and PostgreSQL does.

After spending some time both in Django source and on their site I eventually found out that running the SQL as Database-backend-specific SQL data doesn't mangle it. Unfortunately this information was not included in the documentation.

RSS 2.0