[SOLVED] django – Unable to set delimiter in raw sql (MySQL)

Issue

I want to define a stored procedure by a migration. Before this I’m trying to set delimiter but getting django.db.utils.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER $$' at line 1")

Code:

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('...', '...'),
    ]

    operations = [
        migrations.RunSQL("DELIMITER $$"),
        # ...
        migrations.RunSQL("DELIMITER ;"),
    ]

I’ve found information about DELIMITER is a client keyword which might be not supported by specific tool but what is the right way in django?

Solution

Setting delimiter wasn’t needed. I just removed these rows and it worked.
(see post comments)

Answered By – Powercoder

Answer Checked By – Mildred Charles (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *