Search code examples
python-3.xpymysql

PyMySQL with Flask: %d format: a number is required, not str with stored procedure


After configuring PyMySQL in Python, i fell over the issue that I cannot execute a stored procedure. cursor.callproc('storingSystemCreateCategory', 'Test12444') returns: %d format: a number is required, not str.

The procedure looks like:

DELIMITER //
CREATE PROCEDURE storingSystemCreateCategory(IN name VARCHAR(255))
 BEGIN
 INSERT INTO StoringSystem.Category(`createdAt`, `updatedAt`, `deleted`, `name`)
 VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, False, name);
 END //
DELIMITER ;

I'm using http://flask-mysql.readthedocs.io/en/latest/#usage together with the setup above.

How can I execute the procedure correctly?


Solution

  • Traceback is very important information describe where the exception came from. You must paste traceback, not only error message.