Menu

DELIMITER $$ produces error 1064

Help
Jon
2007-08-16
2012-09-19
  • Jon

    Jon - 2007-08-16

    I have python 2.5, MySQLdb 1.2.1-1, and MySQL 5.0.22. I can change the delimiter to $$ just fine from a mysql shell. But I cannot do it from python and MySQLdb.

    >>> curs.execute("delimiter ;")
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python2.5/site-packages/MySQLdb/cursors.py", line 163, in execute
    self.errorhandler(self, exc, value)
    File "/usr/lib/python2.5/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler
    raise errorclass, errorvalue
    _mysql_exceptions.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")

    Does anyone know why this would be happening?

     
    • Jon

      Jon - 2007-08-16

      Thanks. It took some tweaking after I removed the DELIMITER stuff. It works great now. :)

       
    • Andy Dustman

      Andy Dustman - 2007-08-16

      DELIMITER is purely a feature of the command-line client. You don't need it anyway. You shouldn't add SQL terminators to your statements; DB-API modules only work on one statement at a time. If you are creating a stored procedure or something after that, just use semicolons as you would expect.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.