Inital SQL files breaking in Django syncdb
Posted at 07:00 on 15 May 2009
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.