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


Kommentera inlägget här:

Kom ihåg mig?

E-postadress: (publiceras ej)



RSS 2.0