petehunt/PyMySQL — Issue #98: Error when trying to create stored procedure
Author: scottfrazer
Created: 2012-02-08 22:41:48+00:00
State: open

```python
import pymysql
conn = pymysql.connect(host='127.0.0.1', user='hydrant-test', passwd='', db='hydrant-test')
cur = conn.cursor()
cur.execute("""
DELIMITER @@
CREATE PROCEDURE test()
BEGIN
SELECT 1;
END
@@
DELIMITER ;
""")
cur.close()
conn.close()
```

The error I receive is:

pymysql.err.ProgrammingError: (1064, u"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 @@\n CREATE PROCEDURE test()\n BEGIN\n SELECT 1;\n END\n @@\n DELIMI' at line 1")

The SQL in the python code above works through normal means (same user and DB)