james mckay dot net
because there are few things that are less logical than business logic

Inital SQL files breaking in Django syncdb

There’s a fairly long-standing bug in Django where initial SQL files break if they contain a double hyphen in a quoted string when you run manage.py syncdb. This bug also causes problems if you’re trying to create stored procedures in MySQL and need to change the delimiter to allow multiple statements.

Seems the problem is some overly naive code to split the SQL file into individual statements. Unfortunately there’s no easy fix without at least partially reinventing the SQL parser or spawning a separate mysql command line client process. Best approach in the meantime is to avoid using stored procedures and check any scripts that you do have using Django’s unit test framework.

1 comment:

  • # Reply from ZK@Web Marketing Blog at 06:30 on 1 Jul 2009

    I had seen some of the tools floating around and decided to watch the panel from Djangocon to get a better overview. For the record the represented tools are dmigrations, south and django-evolution. At some point while watching the video I think I was convinced each was the right solution; they all have features/use cases to recommend them.

Comments are closed.